PySide.QtCore.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 PySide.QtCore.QByteArrayMatcher.indexIn() is faster than matching a plain PySide.QtCore.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 PySide.QtCore.QByteArrayMatcher 采用 PySide.QtCore.QByteArray you want to search for. Then call PySide.QtCore.QByteArrayMatcher.indexIn() 在 PySide.QtCore.QByteArray that you want to search.
另请参阅
PySide.QtCore.QByteArray QStringMatcher
| 参数: |
|
|---|
Constructs an empty byte array matcher that won't match anything. Call PySide.QtCore.QByteArrayMatcher.setPattern() to give it a pattern to match.
Constructs a byte array matcher that will search for pattern 。调用 PySide.QtCore.QByteArrayMatcher.indexIn() to perform a search.
拷贝 other byte array matcher to this byte array matcher.
Constructs a byte array matcher from pattern . pattern has the given length . pattern must remain in scope, but the destructor does not delete pattern .
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.int |
Searches the char string str , which has length len , from byte position from (default 0, i.e. from the first byte), for the byte array PySide.QtCore.QByteArrayMatcher.pattern() that was set in the constructor or in the most recent call to PySide.QtCore.QByteArrayMatcher.setPattern() . Returns the position where the PySide.QtCore.QByteArrayMatcher.pattern() matched in str , or -1 if no match was found.
| 参数: |
|
|---|---|
| 返回类型: |
PySide.QtCore.int |
Searches the byte array ba , from byte position from (default 0, i.e. from the first byte), for the byte array PySide.QtCore.QByteArrayMatcher.pattern() that was set in the constructor or in the most recent call to PySide.QtCore.QByteArrayMatcher.setPattern() . Returns the position where the PySide.QtCore.QByteArrayMatcher.pattern() matched in ba , or -1 if no match was found.
| 返回类型: | PySide.QtCore.QByteArray |
|---|
Returns the byte array pattern that this byte array matcher will search for.
| 参数: | pattern – PySide.QtCore.QByteArray |
|---|
Sets the byte array that this byte array matcher will search for to pattern .