final class CountMatchingLinesInputProcessor extends DefaultInputProcessor implements LineProcessor
LineMatcher
passed
to the constructor.Constructor and Description |
---|
CountMatchingLinesInputProcessor(GrepCommand command,
ExecutionContext context,
LineProcessor output,
LineMatcher matcher) |
Modifier and Type | Method and Description |
---|---|
void |
begin(Input input,
LineProcessor output)
Indicates that the line processing task is about to start for the
specified
input device. |
void |
finish()
Indicates that this line processing task is complete and can finished.
|
void |
finish(Input input,
LineProcessor output)
Indicates that this line processing task is complete for the specified
input device and can finished. |
boolean |
processLine(Input input,
Line line,
LineProcessor output)
Processes a single line and returns true if this
InputProcessor
is ready to process more lines. |
boolean |
processLine(Line line)
Processes a single line and returns true if this
LineProcessor is
ready to process more lines. |
public CountMatchingLinesInputProcessor(GrepCommand command, ExecutionContext context, LineProcessor output, LineMatcher matcher)
public void begin(Input input, LineProcessor output)
InputProcessor
input
device.begin
in interface InputProcessor
begin
in class DefaultInputProcessor
input
- the input device whose lines are about to be processed nextoutput
- the output to write topublic boolean processLine(Line line)
LineProcessor
LineProcessor
is
ready to process more lines. Returning false indicates that the process
can be finished
because subsequent lines would not
change the result anyway.processLine
in interface LineProcessor
line
- the line to processLineProcessor
is ready to process more
lines, and false if it does not require any more input linespublic boolean processLine(Input input, Line line, LineProcessor output)
InputProcessor
InputProcessor
is ready to process more lines. Returning false indicates that the
process can be finished
because
subsequent lines would not change the result anyway.processLine
in interface InputProcessor
processLine
in class DefaultInputProcessor
input
- the input device, the source of the given line
line
- the line to processoutput
- the output to write toInputProcessor
is ready to process more
lines, and false if it does not require any more input linespublic void finish(Input input, LineProcessor output)
InputProcessor
input
device and can finished.
Simple output devices usually perform a flush
operation in this
method. More complex commands may perform the real operation in this
method, for instance write the total count of lines or words to the
target file or stream.
finish
in interface InputProcessor
finish
in class DefaultInputProcessor
input
- the input device whose lines have now all been processedoutput
- the output to write topublic void finish()
LineProcessor
Simple output devices usually perform a flush
operation in this
method. More complex commands may perform the real operation in this
method, for instance write the total count of lines or words to the
target file or stream.
finish
in interface LineProcessor
Copyright © 2024. All rights reserved.