org.apache.ws.commons.tcpmon.core.filter
Class Tee
java.lang.Object
org.apache.ws.commons.tcpmon.core.filter.Tee
- All Implemented Interfaces:
- StreamFilter
public class Tee
- extends Object
- implements StreamFilter
A filter that copies all the data in the stream to a given OutputStream
.
The data is written to the output stream before being processed by filters further
down the pipeline. The target output stream can be specified using the
Tee(OutputStream)
constructor or later using the
setOutputStream(OutputStream)
method. If data is submitted to the filter before the
output stream has been set, it will be held back until
setOutputStream(OutputStream)
has been called and the filter is
invoked again.
Tee
public Tee()
Tee
public Tee(OutputStream out)
setOutputStream
public void setOutputStream(OutputStream out)
isReadOnly
public boolean isReadOnly()
- Description copied from interface:
StreamFilter
- Determine whether this filter is read-only. A read-only filter will not
modify any data in the stream and exclusively use the skip operation to
advance in the stream. The information provided by this method may be
used to optimize processing of the stream.
- Specified by:
isReadOnly
in interface StreamFilter
- Returns:
true
if this filter is read-only
invoke
public void invoke(Stream stream)
- Description copied from interface:
StreamFilter
- Invoke the filter. This method is called by
Pipeline
when data is available for processing. The implementation can
modify the stream by discarding bytes from the stream and
inserting new data. If it doesn't wish to modify the stream,
it should skip the relevant parts, so that it will be processed
by the next filter in the pipeline.
An implementation is not required to process (skip or discard)
all the data available on each invocation. If after the invocation
of this method Stream.available()
is non zero, the remaining
(unprocessed) data will be available again during the next invocation
of the filter.
- Specified by:
invoke
in interface StreamFilter
- Parameters:
stream
- the stream to process
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © The Apache Software Foundation. All Rights Reserved.