Qt Jambi Home

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

public class QByteArrayMatcher
extends QtJambiObject

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, QStringMatcher

Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
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
static QByteArrayMatcher fromNativePointer(QNativePointer nativePointer)
          This function returns the QByteArrayMatcher instance pointed to by nativePointer
 int indexIn(QByteArray ba)
          Equivalent to indexIn(ba, 0).
 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.
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, 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
clone, equals, 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(QByteArrayMatcher other)

Copies the other byte array matcher to this byte array matcher.


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.

Method Detail

indexIn

public final int indexIn(QByteArray ba)

Equivalent to indexIn(ba, 0).


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, indexIn

fromNativePointer

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

Parameters:
nativePointer - the QNativePointer of which object should be returned.

nativePointerArray

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

Parameters:
array - the array that the returned pointer will point to.
Returns:
a QNativePointer that is pointing to the specified array.

Qt Jambi Home