public class FixedSizeBufferInputStreamConsumer extends BufferInputStreamConsumer
InputStream
, placing what is read into a fixed-size buffer,
until it encounters the end of the stream or an exception is thrown. If it
reads more bytes than will fit in the buffer, the buffer will contain the
most recent buffer-size bytes read.buffer, bufferPosition
stream
Constructor and Description |
---|
FixedSizeBufferInputStreamConsumer(java.io.InputStream stream,
int bufferSize)
Creates an instance with the specified stream and buffer size.
|
Modifier and Type | Method and Description |
---|---|
static InputStreamConsumerFactory |
newFactory(int bufferSize)
Creates a factory that returns a new instance of this class with the
specified buffer size.
|
protected void |
postProcessData()
Performs post-processing of data.
|
protected int |
read()
Reads a chunk of data from the input stream.
|
data
call, cancel
public FixedSizeBufferInputStreamConsumer(java.io.InputStream stream, int bufferSize)
stream
- stream from which to readbufferSize
- size of the buffer into which data read from the input
stream should be placedprotected int read() throws java.io.IOException
AbstractInputStreamConsumer
read
in class AbstractInputStreamConsumer
java.io.IOException
- if an I/O error occursprotected void postProcessData()
AbstractInputStreamConsumer
This method does nothing, but subclasses may override it to do something.
postProcessData
in class AbstractInputStreamConsumer
public static InputStreamConsumerFactory newFactory(int bufferSize)
bufferSize
- size of the buffer into which data read from the input
stream should be placed