public final class InputProcessors extends Object
InputProcessor
classes.Modifier and Type | Method and Description |
---|---|
static InputProcessor |
ansiStripping(InputProcessor delegate)
Returns the processor that strips any
ANSI escape sequences
and passes the result to the delegate.
|
static InputProcessor |
bridge(LineProcessor lineProcessor)
Returns the processor converting characters to the whole lines passing
them to the given line processor.
|
static InputProcessor |
copying(Writer writer)
Returns the processor that writes every character passed for processing
to the given writer.
|
static InputProcessor |
printing(PrintWriter out)
Returns the processor printing all characters passed for processing to
the given writer.
|
static InputProcessor |
proxy(InputProcessor... processors)
Returns the processor acting as a proxy.
|
@NonNull public static InputProcessor bridge(@NonNull LineProcessor lineProcessor)
Any reset or close is delegated to the corresponding method of line processor.
Returned processor is not thread safe.
lineProcessor
- processor consuming parsed lines@NonNull public static InputProcessor proxy(@NonNull InputProcessor... processors)
Any action taken on this processor is distributed to all processors passed as arguments in the same order as they were passed to this method.
Returned processor is not thread safe.
processors
- processor to which the actions will be distributed@NonNull public static InputProcessor copying(@NonNull Writer writer)
Reset action on the returned processor is noop. Processor closes the
writer on InputProcessor.close()
.
Returned processor is not thread safe.
writer
- processed characters will be written to this writer@NonNull public static InputProcessor printing(@NonNull PrintWriter out)
Reset action on the returned processor is noop. Processor closes the
writer on InputProcessor.close()
.
Returned processor is not thread safe.
out
- where to print received characters@NonNull public static InputProcessor ansiStripping(@NonNull InputProcessor delegate)
Reset and close methods on the returned processor invokes the corresponding actions on delegate.
Returned processor is not thread safe.
delegate
- processor that will receive characters without control
sequences