ewe.io
Class DataProcessorStream
java.lang.Object
ewe.util.Errorable
ewe.io.BasicStreamObject
ewe.io.StreamObject
ewe.io.StreamAdapter
ewe.io.DataProcessorStream
- All Implemented Interfaces:
- BasicStream, BufferedStream, OverridesClose, Stream, Streamable, StreamCanPause
- public class DataProcessorStream
- extends StreamAdapter
- implements OverridesClose
This is a ONE-WAY stream. Which way is up to you - depending on whether
you write data to it or read data from it. You MUST ensure that you flush (for output)
or close the stream after you have finished sending/receiving all the data to ensure
that data processing is fully complete.
This does NOT call closeProcess on the DataProcessor.
| Methods inherited from class ewe.io.StreamObject |
close, doRead, doWrite, flush, nap, nap, read, readAByte, readBytes, readBytes, write, writeAByte, writeBytes, writeBytes |
| Methods inherited from interface ewe.io.Stream |
flush, read, read, read, readBytes, readBytes, toInputStream, toOutputStream, write, write, write, writeBytes, writeBytes |
blockSize
protected int blockSize
padByte
public byte padByte
- In the case of block sizes greater than 1, it may be necessary to pad
the final set of data before processing. The padByte value is used to
determine the byte value that will be used for this padding.
processor
public DataProcessor processor
DataProcessorStream
public DataProcessorStream(DataProcessor processor,
BasicStream stream)
DataProcessorStream
public DataProcessorStream(DataProcessor processor,
BasicStream stream,
int bufferSize)
cantWrite
protected int cantWrite()
cantProcess
protected int cantProcess(Exception e)
writeSomeOutput
protected int writeSomeOutput()
clearOutput
protected boolean clearOutput()
nonBlockingWrite
public int nonBlockingWrite(byte[] data,
int offset,
int length)
- Description copied from class:
StreamAdapter
- This calls the nonBlockingWrite() of the client BasicStream.
- Specified by:
nonBlockingWrite in interface BasicStream- Overrides:
nonBlockingWrite in class StreamAdapter
nonBlockingRead
public int nonBlockingRead(byte[] data,
int offset,
int length)
- Description copied from class:
StreamAdapter
- This calls the nonBlockingRead() of the client BasicStream.
- Specified by:
nonBlockingRead in interface BasicStream- Overrides:
nonBlockingRead in class StreamAdapter
finalWrite
protected boolean finalWrite()
closeStream
public boolean closeStream()
throws IOException
- Description copied from interface:
BasicStream
- This is non-blocking. It returns true if the close completed, false if it did not,
or throws an exception on error.
- Specified by:
closeStream in interface BasicStream- Overrides:
closeStream in class StreamAdapter
- Throws:
IOException