com.wizzardo.tools.io
Class BoyerMoore

java.lang.Object
  extended by com.wizzardo.tools.io.BoyerMoore

public class BoyerMoore
extends java.lang.Object


Field Summary
protected static int ALPHABET_SIZE
           
protected static java.nio.charset.Charset UTF8
           
 
Constructor Summary
BoyerMoore(byte[] needle)
           
BoyerMoore(byte[] needle, int offset, int length)
           
BoyerMoore(java.lang.String s)
           
 
Method Summary
 int search(byte[] haystack)
          Returns the index within this string of the first occurrence of the specified substring.
 int search(byte[] haystack, int offset, int length)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UTF8

protected static final java.nio.charset.Charset UTF8

ALPHABET_SIZE

protected static final int ALPHABET_SIZE
See Also:
Constant Field Values
Constructor Detail

BoyerMoore

public BoyerMoore(java.lang.String s)

BoyerMoore

public BoyerMoore(byte[] needle)

BoyerMoore

public BoyerMoore(byte[] needle,
                  int offset,
                  int length)
Method Detail

search

public int search(byte[] haystack)
Returns the index within this string of the first occurrence of the specified substring. If it is not a substring, return -1.

Parameters:
haystack - The string to be scanned
Returns:
The start index of the substring

search

public int search(byte[] haystack,
                  int offset,
                  int length)