|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--kiwi.text.PatternMatcher
A simple interface for performing Perl5 regular expression matches on strings and input streams. This class is a beanlike wrapper for the OROMatcher(TM) class library.
Constructor Summary | |
PatternMatcher()
Construct a new PatternMatcher . |
Method Summary | |
void |
disposeSource()
Release the input source. |
PatternMatch |
getNextMatch()
Find the next pattern in the input. |
PatternMatch |
matches(String text)
Determine if a string matches the pattern. |
void |
setIgnoreCase(boolean flag)
Toggle case sensitivity. |
void |
setPattern(String pattern)
Set the regular expression for subsequent pattern matching. |
void |
setSource(InputStream input)
Set the source for pattern matching to an input stream. |
void |
setSource(String input)
Set the source for pattern matching to a string. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public PatternMatcher()
PatternMatcher
.Method Detail |
public void setIgnoreCase(boolean flag)
flag
is true, case
will be ignored in patterns subsequently passed to
setPattern()
; otherwise, case sensitivity will be on (the
default).public void setPattern(String pattern) throws IllegalArgumentException
pattern
- The pattern (in Perl5 regular expression syntax).MalformedPatternException
.public PatternMatch matches(String text)
text
- The string to compare.PatternMatch
object representing to the match, or
null if the string did not match the pattern.public void setSource(String input)
findNext()
returns the next match found in the string (if
any).input
- The input string to search for pattern matches.public void setSource(InputStream input)
findNext()
returns the next match found in the input
stream (if any).public PatternMatch getNextMatch() throws IOException
PatternMatch
object representing the next match in
the input, or null if there are no more matches.public void disposeSource()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |