public abstract class FilterCommand
extends java.lang.Object
FilterCommandFactory
.Modifier and Type | Field and Description |
---|---|
protected java.io.InputStream |
in
The
InputStream this command should read from |
protected java.io.OutputStream |
out
The
OutputStream this command should write to |
Constructor and Description |
---|
FilterCommand(java.io.InputStream in,
java.io.OutputStream out)
Constructor for FilterCommand
|
Modifier and Type | Method and Description |
---|---|
abstract int |
run()
Execute the command.
|
protected java.io.InputStream in
InputStream
this command should read fromprotected java.io.OutputStream out
OutputStream
this command should write topublic FilterCommand(java.io.InputStream in, java.io.OutputStream out)
FilterCommand implementors are required to manage the in and out streams (close on success and/or exception).
in
- The InputStream
this command should read fromout
- The OutputStream
this command should write topublic abstract int run() throws java.io.IOException
in
and to write the result to out
. It returns the
number of bytes it read from in
. It should be called in a loop
until it returns -1 signaling that the InputStream
is
completely processed.
On successful completion (return -1) or on Exception, the streams
in
and out
are closed by the implementation.