public class SearchPattern
extends java.lang.Object
| Modifier and Type | Method | Description |
|---|---|---|
static SearchPattern |
compile(byte[] pattern) |
Produces a SearchPattern instance which can be used
to find matches of the pattern in data
|
static SearchPattern |
compile(java.lang.String pattern) |
Produces a SearchPattern instance which can be used
to find matches of the pattern in data
|
int |
endsWith(byte[] data,
int offset,
int length) |
Search for a partial match of the pattern at the end of the data.
|
int |
getLength() |
|
int |
match(byte[] data,
int offset,
int length) |
Search for a complete match of the pattern within the data
|
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.
|
public static SearchPattern compile(byte[] pattern)
pattern - byte array containing the patternpublic static SearchPattern compile(java.lang.String pattern)
pattern - string containing the patternpublic int match(byte[] data,
int offset,
int length)
data - The data in which to search for. The data may be arbitrary binary data,
but the pattern will always be StandardCharsets.US_ASCII encoded.offset - The offset within the data to start the searchlength - The length of the data to searchpublic int endsWith(byte[] data,
int offset,
int length)
data - The data in which to search for. The data may be arbitrary binary data,
but the pattern will always be StandardCharsets.US_ASCII encoded.offset - The offset within the data to start the searchlength - The length of the data to searchpublic int startsWith(byte[] data,
int offset,
int length,
int matched)
data - The data in which to search for. The data may be arbitrary binary data,
but the pattern will always be StandardCharsets.US_ASCII encoded.offset - The offset within the data to start the searchlength - The length of the data to searchmatched - The length of the partial pattern already matchedpublic int getLength()
Copyright © 1995–2018 Webtide. All rights reserved.