| java.lang.Object com.lutris.util.BMByteSearch
BMByteSearch | public class BMByteSearch (Code) | | Implements the Boyer-Moore pattern matching algorithm for a given
byte pattern. This object implements searches on signed byte arrays.
The algorithm was obtained from "Computer Algorithms - Introduction to
Design and Analysis, Second Edition" by Sara Baase.
|
Constructor Summary | |
public | BMByteSearch(String pattern) Creates a precomputed Boyer-Moore byte string search object
from the given pattern. | public | BMByteSearch(byte[] pattern) Creates a precomputed Boyer-Moore byte string search object
from the given pattern. | public | BMByteSearch(byte[] pattern, int offset, int length) Creates a precomputed Boyer-Moore byte string search object
from a portion of the given pattern array. |
Method Summary | |
public int | getPatternLength() Returns the length of the pattern for this searcher. | public int | search(byte[] byteString) Search for the previously pre-compiled pattern string in an
array of bytes. | public int | search(byte[] byteString, int offset, int length) Search for the previously pre-compiled pattern string in an
array of bytes. |
BMByteSearch | public BMByteSearch(String pattern)(Code) | | Creates a precomputed Boyer-Moore byte string search object
from the given pattern. The unicode characters in pattern
are truncated if greater than 255, and converted in twos-complement
fashion, to appropriate negative byte values, if necessary.
This method is provided as a convenience for searching for patterns
within 8 bit byte strings composed of character data.
Parameters: pattern - The pattern create this object for. |
BMByteSearch | public BMByteSearch(byte[] pattern)(Code) | | Creates a precomputed Boyer-Moore byte string search object
from the given pattern.
Parameters: pattern - Binary pattern to search for. |
BMByteSearch | public BMByteSearch(byte[] pattern, int offset, int length)(Code) | | Creates a precomputed Boyer-Moore byte string search object
from a portion of the given pattern array.
Parameters: pattern - Byte array containing a pattern to search for. Parameters: offset - Offset to beginning of search pattern. Parameters: length - Length of the search pattern. |
getPatternLength | public int getPatternLength()(Code) | | Returns the length of the pattern for this searcher.
The search pattern length. |
search | public int search(byte[] byteString)(Code) | | Search for the previously pre-compiled pattern string in an
array of bytes. This method uses the Boyer-Moore pattern
search algorithm.
Parameters: byteString - Array of bytes in which to searchfor the pattern. The array index where the patternbegins in the string, or -1 if the pattern was not found. |
search | public int search(byte[] byteString, int offset, int length)(Code) | | Search for the previously pre-compiled pattern string in an
array of bytes. This method uses the Boyer-Moore pattern
search algorithm.
Parameters: byteString - Array of bytes in which to searchfor the pattern. Parameters: offset - The the index in byteString where the search is to begin. Parameters: length - The number of bytes to search inbyteString . The array index where the patternbegins in the string, or -1 if the pattern was not found. |
|
|