|
EAF 7.4 Implementation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.lutris.util.BMByteSearch
public class BMByteSearch
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 | |
---|---|
BMByteSearch(byte[] pattern)
Creates a precomputed Boyer-Moore byte string search object from the given pattern. |
|
BMByteSearch(byte[] pattern,
int offset,
int length)
Creates a precomputed Boyer-Moore byte string search object from a portion of the given pattern array. |
|
BMByteSearch(java.lang.String pattern)
Creates a precomputed Boyer-Moore byte string search object from the given pattern. |
Method Summary | |
---|---|
int |
getPatternLength()
Returns the length of the pattern for this searcher. |
int |
search(byte[] byteString)
Search for the previously pre-compiled pattern string in an array of bytes. |
int |
search(byte[] byteString,
int offset,
int length)
Search for the previously pre-compiled pattern string in an array of bytes. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BMByteSearch(java.lang.String pattern)
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.
pattern
- The pattern create this object for.public BMByteSearch(byte[] pattern)
pattern
- Binary pattern to search for.public BMByteSearch(byte[] pattern, int offset, int length)
pattern
- Byte array containing a pattern to search for.offset
- Offset to beginning of search pattern.length
- Length of the search pattern.Method Detail |
---|
public int getPatternLength()
public int search(byte[] byteString)
byteString
- Array of bytes in which to search
for the pattern.
-1
if the pattern was not found.public int search(byte[] byteString, int offset, int length)
byteString
- Array of bytes in which to search
for the pattern.offset
- The the index in byteString
where the search is to begin.length
- The number of bytes to search in
byteString
.
-1
if the pattern was not found.
|
EAF 7.4 Implementation | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |