![]()
|
Jakarta-ORO 2.0.6 API: Class MatchActionProcessor
org.apache.oro.text
|
Constructor Summary | |
MatchActionProcessor()
Default constructor for MatchActionProcessor. |
|
MatchActionProcessor(PatternCompiler compiler,
PatternMatcher matcher)
Creates a new MatchActionProcessor instance initialized with the specified pattern compiler and matcher. |
Method Summary | |
void |
addAction(java.lang.String pattern)
Binds a patten to the default action. |
void |
addAction(java.lang.String pattern,
int options)
Binds a patten to the default action, providing options to be used to compile the pattern. |
void |
addAction(java.lang.String pattern,
int options,
MatchAction action)
Registers a pattern action pair, providing options to be used to compile the pattern. |
void |
addAction(java.lang.String pattern,
MatchAction action)
Registers a pattern action pair. |
void |
processMatches(java.io.InputStream input,
java.io.OutputStream output)
This method reads the provided input one line at a time and for every registered pattern that is contained in the line it executes the associated MatchAction's processMatch() method. |
void |
setFieldSeparator(java.lang.String separator)
Sets the field separator to use when splitting a line into fields. |
void |
setFieldSeparator(java.lang.String separator,
int options)
Sets the field separator to use when splitting a line into fields. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MatchActionProcessor(PatternCompiler compiler, PatternMatcher matcher)
setFieldSeparator()
.
compiler
- The PatternCompiler to use to compile registered
patterns.matcher
- The PatternMatcher to use when searching for matches.public MatchActionProcessor()
MatchActionProcessor(new Perl5Compiler(), new Perl5Matcher());
Method Detail |
public void addAction(java.lang.String pattern, int options, MatchAction action) throws MalformedPatternException
pattern
- The pattern to bind to an action.options
- The compilation options to use for the pattern.action
- The action to associate with the pattern.MalformedPatternException
- If the pattern cannot be compiled.public void addAction(java.lang.String pattern, int options) throws MalformedPatternException
pattern
- The pattern to bind to an action.options
- The compilation options to use for the pattern.MalformedPatternException
- If the pattern cannot be compiled.public void addAction(java.lang.String pattern) throws MalformedPatternException
pattern
- The pattern to bind to an action.MalformedPatternException
- If the pattern cannot be compiled.public void addAction(java.lang.String pattern, MatchAction action) throws MalformedPatternException
pattern
- The pattern to bind to an action.action
- The action to associate with the pattern.MalformedPatternException
- If the pattern cannot be compiled.public void setFieldSeparator(java.lang.String separator, int options) throws MalformedPatternException
separator
- A regular expression defining the field separator.options
- The options to use when compiling the separator.MalformedPatternException
- If the separator cannot be compiled.public void setFieldSeparator(java.lang.String separator) throws MalformedPatternException
separator
- A regular expression defining the field separator.MalformedPatternException
- If the separator cannot be compiled.public void processMatches(java.io.InputStream input, java.io.OutputStream output) throws java.io.IOException
setFieldSeparator()
, the
fields member of the MatchActionInfo instance passed to the
processMatch() method is set to a Vector of Strings containing
the split fields of the line. Otherwise the fields member is set
to null. If no match was performed to invoke the action (i.e.,
a null pattern was registered), then the match member is set
to null. Otherwise, the match member will contain the result of
the match.
The input stream, having been exhausted, is closed right before the method terminates and the output stream is flushed.
input
- The input stream from which to read lines.output
- Where to send output.java.io.IOException
- If an error occurs while reading input
or writing output.MatchActionInfo
|
![]() |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |