net.sf.mmm.util.io.api.spi
Interface DetectorStreamProcessor
- All Known Implementing Classes:
- ProcessableDetectorInputStream.WrapperInputStream, ProcessableDetectorOutputStream.WrapperOutputStream
public interface DetectorStreamProcessor
This is the interface for a processor that can be plugged into a
DetectorStream. Such
DetectorStream holds a chain of
DetectorStreamProcessors and routes the stream data through this
chain.
At the head of this chain is the producer of the data (the native
InputStream or the caller that wants to write to the
wrapped OutputStream). The end of the chain is the consumer
of the data (the native OutputStream or caller that wants to
read from the
wrapped InputStream).
An implementation of this interface can detect information (typically
metadata) from the streamed data. Additionally it is possible to manipulate
the streamed data by removing data
from the stream and/or
inserting new data into the stream.
- Since:
- 1.1.0
- Author:
- Joerg Hohwiller (hohwille at users.sourceforge.net)
- See Also:
DetectorStream,
DetectorStreamProcessorFactory
process
void process(DetectorStreamBuffer buffer,
Map<String,Object> metadata,
boolean eos)
throws IOException
- This method performs the actual detection and optionally manipulates the
data. All this happens via the given
buffer that provides
access to read buffered parts of the stream. As streams are typically
larger pieces of data, this method will be called repetitive in order to
process the entire stream.
ATTENTION:
A legal implementation of this interface has to consume data from the given
buffer whenever it is invoked. To ensure your implementation
can always make an appropriate decision it may have to ensure a specific
lookahead.
- Parameters:
buffer - allows you to read parts of the streamed data as well as to
manipulate the data.metadata - is the Map with the meta-data.eos - - true if the end of the stream has been reached
and the given buffer has to be
- Throws:
IOException - in case of an Input/Output error. Should only be used
internally.
Copyright © 2001-2010 mmm-Team. All Rights Reserved.