public abstract class KnuthMorrisPratt
extends java.lang.Object
computeFailure function pre-processes the pattern to
facilitate a faster substring search by tracking the longest prefix
that's also a suffix at each point in the pattern. This preprocessing
step is crucial for the efficiency of the KMP algorithm.| Constructor and Description |
|---|
KnuthMorrisPratt() |
| Modifier and Type | Method and Description |
|---|---|
static int |
indexOf(byte[] data,
byte[] pattern,
int indexFrom)
Searches for a byte pattern in a larger data buffer.
|
static int |
indexOf(byte[] data,
byte[] pattern,
int indexFrom,
int indexTo)
Searches for a byte pattern in a larger data buffer.
|
public static int indexOf(byte[] data,
byte[] pattern,
int indexFrom)
data - The data bufferpattern - The pattern to search forindexFrom - The start index to begin search withpublic static int indexOf(byte[] data,
byte[] pattern,
int indexFrom,
int indexTo)
data - The data bufferpattern - The pattern to search forindexFrom - The start index to begin search withindexTo - The end index (exclusive) to end search with, may be -1
to skip the end index limit