org.apache.ws.commons.tcpmon.core.filter
Class Pipeline

java.lang.Object
  extended by org.apache.ws.commons.tcpmon.core.filter.Pipeline

public class Pipeline
extends Object

Class that sends a byte stream through a sequence of filters. Each filter receives as input the (potentially modified) output of the previous filter in the chain.

The pipeline works in push mode and is non blocking. This distinguishes it from a chain of (Filter)InputStreams. Also, a filter is not required to process all received data on each invocation (in which case it gets a chance to process the unprocessed data during the next invocation). This is useful when the filter requires more lookahead than is available. This distinguishes a pipeline from a chain of (Filter)OutputStreams (where each OutputStream is responsible itself for buffering unprocessed data).

Finally, the implementation optimizes buffer allocation and minimizes array copy operations.


Constructor Summary
Pipeline()
           
Pipeline(int bufferSize)
           
 
Method Summary
 void addFilter(StreamFilter filter)
           
 void close()
           
 OutputStream getOutputStream()
           
 int readFrom(InputStream in)
           
 void setErrorListener(ErrorListener errorListener)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Pipeline

public Pipeline(int bufferSize)

Pipeline

public Pipeline()
Method Detail

setErrorListener

public void setErrorListener(ErrorListener errorListener)

addFilter

public void addFilter(StreamFilter filter)

readFrom

public int readFrom(InputStream in)
             throws IOException
Throws:
IOException

close

public void close()

getOutputStream

public OutputStream getOutputStream()


Copyright © The Apache Software Foundation. All Rights Reserved.