Class ByteSearch
java.lang.Object
org.apache.axiom.attachments.utils.ByteSearch
Deprecated.
This class was part of the MIME parser in Axiom versions before 1.2.13 and is no
             longer used. It will be removed in Axiom 1.3. Please note that the code in this class
             is known to have issues; see AXIOM-449 and AXIOM-450 for more
             information.
Various byte array searching utilities. This includes a "skip search", which is an optimized
 search for finding a byte pattern in a large byte array.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic short[]getSkipArray(byte[] pattern, boolean direction) Deprecated.skipArray Builds a skip array for this pattern and direction.static booleanisEqual(byte[] pattern, byte[] buffer, int start, int end) Deprecated.isEqualstatic intsearch(byte[] search, byte[] bytes, int start, int end, boolean direction) Deprecated.search Look for the search bytes in the bytes array using a straight search.static intskipSearch(byte[] pattern, boolean direction, byte[] buffer, int start, int end, short[] skip) Deprecated.Search a byte sequence for a given pattern.
- 
Constructor Details- 
ByteSearchpublic ByteSearch()Deprecated.
 
- 
- 
Method Details- 
skipSearchpublic static int skipSearch(byte[] pattern, boolean direction, byte[] buffer, int start, int end, short[] skip) Deprecated.Search a byte sequence for a given pattern. The method uses the skip search algorithm. The search can be performed in forward or backward direction, i.e. beginning from the start or end of the byte sequence.- Parameters:
- pattern- byte[]
- direction- true if forward, false if backward
- buffer- byte[] to search
- start- index to start search
- end- index to end search (end index is not within the search)
- skip- short[256] A skipArray generated from a call to generateSkipArray.
- Returns:
- index or -1 if not found
 
- 
getSkipArraypublic static short[] getSkipArray(byte[] pattern, boolean direction) Deprecated.skipArray Builds a skip array for this pattern and direction. The skipArray is used in the optimized skipSearch- Parameters:
- pattern-
- direction-
- Returns:
- short[256]
 
- 
isEqualpublic static boolean isEqual(byte[] pattern, byte[] buffer, int start, int end) Deprecated.isEqual- Parameters:
- pattern-
- buffer-
- start- index
- end- index
- Returns:
- true if the bytes in buffer[start] equal pattern
 
- 
searchpublic static int search(byte[] search, byte[] bytes, int start, int end, boolean direction) Deprecated.search Look for the search bytes in the bytes array using a straight search. Use the skip search if the number of bytes to search is large or if this search is performed frequently.- Parameters:
- search- byte[]
- bytes- byte[] to search
- start- starting index
- end- end index (exclusive
- direction- boolean (true indicates forward search, false is backwards search
- Returns:
- index or -1
 
 
-