public class NullOutput extends Object implements Output
/dev/null, which means that all lines
written to this device are ignored.
Two instances are available, the ABORT instance which returns false
when processLine(Line) which usually causes the program execution to
abort. The DEFAULT instance does not abort program execution to make
sure that no side effects are suppressed.
| Modifier and Type | Field and Description |
|---|---|
static NullOutput |
ABORT
Aborting instance returning false when
processLine(Line) is
called. |
static NullOutput |
DEFAULT
Default instance returning true when
processLine(Line) is
called. |
| Constructor and Description |
|---|
NullOutput(boolean abort)
|
| Modifier and Type | Method and Description |
|---|---|
void |
finish()
Indicates that all output has been written.
|
boolean |
processLine(Line line)
Writes a line to the output.
|
String |
toString() |
public static final NullOutput DEFAULT
processLine(Line) is
called. This ensures that a command does not abort early and it is
guaranteed that no (possibly important) side effects are missed.public static final NullOutput ABORT
processLine(Line) is
called. Note that most commands will abort their execution early with
this output device and some (possibly important) side effects could be
missed.public NullOutput(boolean abort)
DEFAULT or
ABORT constants instead of this constructor.
The abort flag passed to this constructor indicates whether the
process can be aborted early or not; abort=true means that the
method processLine(Line) returns false indicating that this
device does not expect any more input lines. Most commands will abort
their execution early in this case, which means that (possibly important)
side effects are missed.
abort - a flag indicating whether command execution can be aborted
earlypublic boolean processLine(Line line)
OutputprocessLine in interface OutputprocessLine in interface LineProcessorline - the line to write to the output.Output device is ready to process more
lines, and false otherwise; output devices usually return truepublic void finish()
Outputfinish in interface Outputfinish in interface LineProcessorCopyright © 2025. All rights reserved.