net.sf.mmm.util.io.impl
Class ProcessableDetectorStream

java.lang.Object
  extended by net.sf.mmm.util.io.base.AbstractDetectorStream
      extended by net.sf.mmm.util.io.impl.ProcessableDetectorStream
All Implemented Interfaces:
DetectorStream
Direct Known Subclasses:
ProcessableDetectorInputStream, ProcessableDetectorOutputStream

public abstract class ProcessableDetectorStream
extends AbstractDetectorStream

This is the abstract base implementation of a DetectorStream specific for this implementation.

Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)
See Also:
ProcessableDetectorInputStream, ProcessableDetectorInputStream

Field Summary
private  ByteArrayPool byteArrayPool
           
private  DetectorStreamBufferImpl firstBuffer
          The first buffer of the chain.
 
Constructor Summary
ProcessableDetectorStream(Map<String,Object> mutableMetadata, ByteArrayPool byteArrayPool)
          The constructor.
 
Method Summary
protected  ByteArrayPool getByteArrayPool()
          This method gets a pool used to manage byte-arrays.
 void initialize(AbstractDetectorStreamProvider provider, DetectorStreamProcessor lastProcessor)
          This method initializes this class.
 void processInternal(ByteArray buffer, boolean eos)
           
 
Methods inherited from class net.sf.mmm.util.io.base.AbstractDetectorStream
getMetadata, getMutableMetadata, isDone, setDone
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

byteArrayPool

private final ByteArrayPool byteArrayPool
See Also:
getByteArrayPool()

firstBuffer

private DetectorStreamBufferImpl firstBuffer
The first buffer of the chain.

Constructor Detail

ProcessableDetectorStream

public ProcessableDetectorStream(Map<String,Object> mutableMetadata,
                                 ByteArrayPool byteArrayPool)
The constructor.
ATTENTION:
You have to call initialize(AbstractDetectorStreamProvider, DetectorStreamProcessor) after super-call in subclass-constructor.

Parameters:
mutableMetadata - is the initial mutable metadata.
byteArrayPool - is used to pool byte[]-buffers.
Method Detail

initialize

public void initialize(AbstractDetectorStreamProvider provider,
                       DetectorStreamProcessor lastProcessor)
This method initializes this class. It has to be called to complete the construction.

Parameters:
provider - is the DetectorStreamProvider creating this instance.
lastProcessor - is the last DetectorStreamProcessor of the chain (the data-receiver).

processInternal

public void processInternal(ByteArray buffer,
                            boolean eos)
                     throws IOException
Parameters:
buffer - is the next part of the streamed 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.
See Also:
DetectorStreamProcessor.process(net.sf.mmm.util.io.api.spi.DetectorStreamBuffer, Map, boolean)

getByteArrayPool

protected ByteArrayPool getByteArrayPool()
This method gets a pool used to manage byte-arrays.

Returns:
the ByteArrayPool instance.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.