public class ByteSearch extends Object
Constructor and Description |
---|
ByteSearch() |
Modifier and Type | Method and Description |
---|---|
static short[] |
getSkipArray(byte[] pattern,
boolean direction)
skipArray
Builds a skip array for this pattern and direction.
|
static boolean |
isEqual(byte[] pattern,
byte[] buffer,
int start,
int end)
isEqual
|
static int |
search(byte[] search,
byte[] bytes,
int start,
int end,
boolean direction)
search
Look for the search bytes in the bytes array using a straight search.
|
static int |
skipSearch(byte[] pattern,
boolean direction,
byte[] buffer,
int start,
int end,
short[] skip)
Search a byte sequence for a given pattern.
|
public static int skipSearch(byte[] pattern, boolean direction, byte[] buffer, int start, int end, short[] skip)
pattern
- byte[]direction
- true if forward, false if backwardbuffer
- byte[] to searchstart
- index to start searchend
- index to end search (end index is not within the search)skip
- short[256] A skipArray generated from a call to
generateSkipArray.public static short[] getSkipArray(byte[] pattern, boolean direction)
pattern
- direction
- public static boolean isEqual(byte[] pattern, byte[] buffer, int start, int end)
pattern
- buffer
- start
- indexend
- indexpublic static int search(byte[] search, byte[] bytes, int start, int end, boolean direction)
search
- byte[]bytes
- byte[] to searchstart
- starting indexend
- end index (exclusivedirection
- boolean (true indicates forward search, false is backwards searchCopyright © 2004-2013 The Apache Software Foundation. All Rights Reserved.