Class ScannerSearchAlgorithm
java.lang.Object
org.hsqldb.lib.ScannerSearchAlgorithm
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic longthe givenreaderfor the givensearchstr.static longthe givenreaderfor the givensearchstr.static longthe givenreaderfor the givenpattern.
-
Field Details
-
SUGGESTED_MAX_LITERAL_SIZE
public static final int SUGGESTED_MAX_LITERAL_SIZEis 1024. This is the size above which it may be better to useKMPSearchAlgorithm.- See Also:
-
-
Method Details
-
search
the givenreaderfor the givensearchstr.- Parameters:
reader- to searchsearchstr- to findliteral- true to treatsearchstras a literal search term; false to treatsearchstras a regular expression.- Returns:
- zero-based offset into stream at which
searchstris found; -1 if not found,readeris null, orsearchstris null; 0 ifsearchstr.length() == 0 && literal == true. - Throws:
IllegalStateException- if aScannerillegal state occursIllegalArgumentException- if aScannerillegal argument is encountered.
-
search
public static long search(Reader reader, String searchstr, boolean literal) throws NullPointerException, PatternSyntaxException, IllegalStateException, IllegalArgumentException the givenreaderfor the givensearchstr.- Parameters:
reader- to searchsearchstr- to findliteral- true to treatsearchstras a literal search term; false to treatsearchstras a regular expression.- Returns:
- zero-based offset into stream at which
searchstris found; -1 if not found,readeris null, orsearchstris null; 0 ifsearchstr.length() == 0 && literal == true. - Throws:
PatternSyntaxException- ifsearchstrexpression's syntax is invalidIllegalStateException- if aScannerillegal state occursIllegalArgumentException- if aScannerillegal argument is encountered.NullPointerException
-
search
public static long search(Reader reader, Pattern pattern) throws IllegalStateException, IllegalArgumentException the givenreaderfor the givenpattern.- Parameters:
reader- to searchpattern- to find- Returns:
- zero-based offset into stream at which
searchstris found; -1 if not found; - Throws:
NullPointerException- ifreaderis null orpatternis null.IllegalStateException- if aScannerillegal state occursIllegalArgumentException- if aScannerillegal argument is encountered.
-