public class GrowingBufferInputStreamConsumer extends BufferInputStreamConsumer
InputStream
, placing what I read into an automatically
growing buffer, until I encounter the end of the stream or an exception
is thrown.
I check my interrupted status when I can, but I will usually not see that
I have been interrupted since I will almost always be blocked reading my
InputStream
which is not an interruptible channel. So, the best
way to get me to die is to close the InputStream
I am reading.
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_BUFFER_SIZE
Default initial buffer size in bytes.
|
buffer, bufferPosition
exception, finishedChannel, stream
Constructor and Description |
---|
GrowingBufferInputStreamConsumer()
Creates an instance with an initial buffer size of
32 bytes.
|
GrowingBufferInputStreamConsumer(int bufferSize)
Creates an instance with the specified buffer size.
|
GrowingBufferInputStreamConsumer(int bufferSize,
java.lang.String name)
Creates an instance with the specified buffer size and thread name.
|
GrowingBufferInputStreamConsumer(int bufferSize,
java.lang.ThreadGroup group)
Creates an instance with the specified buffer size and thread group.
|
GrowingBufferInputStreamConsumer(int bufferSize,
java.lang.ThreadGroup group,
java.lang.String name)
Creates an instance with the specified buffer size, thread group, and
thread name.
|
GrowingBufferInputStreamConsumer(int bufferSize,
java.lang.ThreadGroup group,
java.lang.String name,
long stackSize)
Creates an instance with the specified buffer size, thread group,
thread name, and thread stack size.
|
Modifier and Type | Method and Description |
---|---|
protected int |
read()
Reads a chunk of data from my input stream.
|
data, initialize
exception, finishedChannel, finishedChannel, hasException, initialize, postProcessData, run, stream, stream
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
public static final int DEFAULT_BUFFER_SIZE
public GrowingBufferInputStreamConsumer()
public GrowingBufferInputStreamConsumer(int bufferSize)
super(bufferSize)
.bufferSize
- initial size of the buffer into which I read data
from my input streampublic GrowingBufferInputStreamConsumer(int bufferSize, java.lang.String name)
super(bufferSize, name)
.bufferSize
- initial size of the buffer into which I read data
from my input streamname
- thread namepublic GrowingBufferInputStreamConsumer(int bufferSize, java.lang.ThreadGroup group)
super(bufferSize, group)
.bufferSize
- initial size of the buffer into which I read data
from my input streamgroup
- thread grouppublic GrowingBufferInputStreamConsumer(int bufferSize, java.lang.ThreadGroup group, java.lang.String name)
super(bufferSize, group, name)
.bufferSize
- initial size of the buffer into which I read data
from my input streamgroup
- thread groupname
- thread namepublic GrowingBufferInputStreamConsumer(int bufferSize, java.lang.ThreadGroup group, java.lang.String name, long stackSize)
super(bufferSize, group, name, stackSize)
.bufferSize
- initial size of the buffer into which I read data
from my input streamgroup
- thread groupname
- thread namestackSize
- thread stack sizeprotected int read() throws java.io.IOException
InputStreamConsumer
read
in class InputStreamConsumer
java.io.IOException
- if an I/O error occurs