SearchPattern

SearchPattern <p> Fast search for patterns within strings and arrays of bytes. Uses an implementation of the Boyer–Moore–Horspool algorithm with a 256 character alphabet. <p> The algorithm has an average-case complexity of O(n) on random text and O(nm) in the worst case. where: m = pattern length n = length of data to search

Members

Functions

endsWith
int endsWith(byte[] data, int offset, int length)

Search for a partial match of the pattern at the end of the data.

getLength
int getLength()

@return The length of the pattern in bytes.

match
int match(byte[] data, int offset, int length)

Search for a complete match of the pattern within the data

startsWith
int startsWith(byte[] data, int offset, int length, int matched)

Search for a possibly partial match of the pattern at the start of the data.

Static functions

compile
SearchPattern compile(byte[] pattern)

Produces a SearchPattern instance which can be used to find matches of the pattern in data

compile
SearchPattern compile(string pattern)

Produces a SearchPattern instance which can be used to find matches of the pattern in data

Variables

alphabetSize
enum int alphabetSize;
Undocumented in source.

Meta