Package ucar.unidata.io
Class KMPMatch
- java.lang.Object
-
- ucar.unidata.io.KMPMatch
-
@Immutable public class KMPMatch extends Object
Knuth-Morris-Pratt Algorithm for Pattern Matching.
-
-
Constructor Summary
Constructors Constructor Description KMPMatch(byte[] match)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetMatchLength()intindexOf(byte[] data, int start, int max)Finds the first occurrence of match in data.
-
-
-
Method Detail
-
getMatchLength
public int getMatchLength()
-
indexOf
public int indexOf(byte[] data, int start, int max)Finds the first occurrence of match in data.- Parameters:
data- search in this byte blockstart- start at data[start]max- end at data[start+max]- Returns:
- index into data[] of first match, else -1 if not found.
-
-