com.trolltech.qt.core
Class QByteArrayMatcher

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QByteArrayMatcher
All Implemented Interfaces:
QtJambiInterface, java.lang.Cloneable

public class QByteArrayMatcher
extends QtJambiObject
implements java.lang.Cloneable

The QByteArrayMatcher class holds a sequence of bytes that can be quickly matched in a byte array. This class is useful when you have a sequence of bytes that you want to repeatedly match against some byte arrays (perhaps in a loop), or when you want to search for the same sequence of bytes multiple times in the same byte array. Using a matcher object and indexIn() is faster than matching a plain QByteArray with QByteArray::indexOf() if repeated matching takes place. This class offers no benefit if you are doing one-off byte array matches.

Create the QByteArrayMatcher with the QByteArray you want to search for. Then call indexIn() on the QByteArray that you want to search.

See also:
QByteArray, and QStringMatcher.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Constructor Summary
QByteArrayMatcher()
          Constructs an empty byte array matcher that won't match anything.
QByteArrayMatcher(QByteArray pattern)
          Constructs a byte array matcher that will search for pattern.
QByteArrayMatcher(QByteArrayMatcher other)
          Copies the other byte array matcher to this byte array matcher.
 
Method Summary
 QByteArrayMatcher clone()
          This method is reimplemented for internal reasons
static QByteArrayMatcher fromNativePointer(QNativePointer nativePointer)
          This method returns the QByteArrayMatcher instance pointed to by nativePointer.
 int indexIn(QByteArray ba)
          Searches the byte array ba, from byte position from (default 0, i.e.
 int indexIn(QByteArray ba, int from)
          Searches the byte array ba, from byte position from (default 0, i.e.
static QNativePointer nativePointerArray(QByteArrayMatcher[] array)
          This function returns a QNativePointer that is pointing to the specified QByteArrayMatcher array.
 QByteArray pattern()
          Returns the byte array pattern that this byte array matcher will search for.
 void setPattern(QByteArray pattern)
          Sets the byte array that this byte array matcher will search for to pattern.
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Constructor Detail

QByteArrayMatcher

public QByteArrayMatcher()
Constructs an empty byte array matcher that won't match anything. Call setPattern() to give it a pattern to match.


QByteArrayMatcher

public QByteArrayMatcher(QByteArray pattern)
Constructs a byte array matcher that will search for pattern. Call indexIn() to perform a search.


QByteArrayMatcher

public QByteArrayMatcher(QByteArrayMatcher other)
Copies the other byte array matcher to this byte array matcher.

Method Detail

indexIn

public final int indexIn(QByteArray ba)
Searches the byte array ba, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in ba, or -1 if no match was found.


indexIn

public final int indexIn(QByteArray ba,
                         int from)
Searches the byte array ba, from byte position from (default 0, i.e. from the first byte), for the byte array pattern() that was set in the constructor or in the most recent call to setPattern(). Returns the position where the pattern() matched in ba, or -1 if no match was found.


pattern

public final QByteArray pattern()
Returns the byte array pattern that this byte array matcher will search for.

See also:
setPattern().


setPattern

public final void setPattern(QByteArray pattern)
Sets the byte array that this byte array matcher will search for to pattern.

See also:
pattern(), and indexIn().


fromNativePointer

public static QByteArrayMatcher fromNativePointer(QNativePointer nativePointer)
This method returns the QByteArrayMatcher instance pointed to by nativePointer.


nativePointerArray

public static QNativePointer nativePointerArray(QByteArrayMatcher[] array)
This function returns a QNativePointer that is pointing to the specified QByteArrayMatcher array.


clone

public QByteArrayMatcher clone()
This method is reimplemented for internal reasons

Overrides:
clone in class java.lang.Object