public class GrowingBufferInputStreamConsumer extends BufferInputStreamConsumer
InputStream
, placing what is read into an automatically
growing buffer, until it encounters the end of the stream or an exception is
thrown.Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
Default initial buffer size in bytes.
|
buffer, bufferPosition
stream
Constructor and Description |
---|
GrowingBufferInputStreamConsumer(java.io.InputStream stream)
Creates an instance with the specified stream and with an initial buffer
size of 32 bytes.
|
GrowingBufferInputStreamConsumer(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()
Creates a factory that returns a new instance of this class with the
default initial buffer size.
|
static InputStreamConsumerFactory |
newFactory(int bufferSize)
Creates a factory that returns a new instance of this class with the
specified initial buffer size.
|
protected int |
read()
Reads a chunk of data from the input stream.
|
data
call, cancel, postProcessData
public static final int DEFAULT_BUFFER_SIZE
public GrowingBufferInputStreamConsumer(java.io.InputStream stream)
GrowingBufferInputStreamConsumer(InputStream, int)
constructor
with the specified stream and a buffer size of
32
.stream
- stream from which to readpublic GrowingBufferInputStreamConsumer(java.io.InputStream stream, int bufferSize)
stream
- stream from which to readbufferSize
- initial 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 occurspublic static InputStreamConsumerFactory newFactory()
public static InputStreamConsumerFactory newFactory(int bufferSize)
bufferSize
- initial size of the buffer into which data read from the
input stream should be placed