|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.io.InputStream | +--uk.org.ogsadai.activity.transform.IncrementalProcessorInputStream
An InputStream
designed to read the output of some
kind of process in incremental stages. An
IncrementalProcessor
is used to perform this actual
processing.
There are many cases where a process writes to an output stream and
it is necessary to retrieve this data produced in stages during the
processing, rather than in a single block when the processing is
complete. This class together with the
IncrementalProcessor
interface provides a solution to
this problem.
This class contains an inner class, which extends
OutputStream
. An instance of this can write to the
same buffer that the read
method reads from. The
IncrementalProcessorInputStream
must be constructed
using an IncrementalProcessor
that uses an instance of
this OutputStream. Whenever a read method is
invoked, processing is performed using the
IncrementalProcessor
, to generate some output that can
be returned.
Nested Class Summary | |
private class |
IncrementalProcessorInputStream.QueueSharingOutputStream
An inner class OutputStream that writes to the
same byte buffer that the surrounding class reads from. |
Field Summary | |
private static java.lang.String |
COPYRIGHT_NOTICE
Copyright statement |
private static int |
DEFAULT_BUFFER_SIZE
Default buffer size. |
private byte[] |
mByte
Used to optimise the read and write methods. |
private IncrementalProcessor |
mProcessor
Used to generate the output that will be read, in incremental stages. |
private ByteQueue |
mQueue
The internal byte buffer, written to and read from. |
Fields inherited from class java.io.InputStream |
|
Constructor Summary | |
IncrementalProcessorInputStream(IncrementalProcessor processor)
Constructs an instance using the specified parameters and the default internal buffer size. |
|
IncrementalProcessorInputStream(IncrementalProcessor processor,
int bufferSize)
Constructs an instance using the specified parameters. |
Method Summary | |
int |
read()
|
int |
read(byte[] bytes,
int start,
int length)
|
Methods inherited from class java.io.InputStream |
available, close, mark, markSupported, read, reset, skip |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static final java.lang.String COPYRIGHT_NOTICE
private static final int DEFAULT_BUFFER_SIZE
private ByteQueue mQueue
private IncrementalProcessor mProcessor
private byte[] mByte
Constructor Detail |
public IncrementalProcessorInputStream(IncrementalProcessor processor) throws java.io.IOException
processor
- The IncrementalProcessor
used to perform
the processing. This should be constructed but not
initialised.
java.io.IOException
- If there is an I/O problem.public IncrementalProcessorInputStream(IncrementalProcessor processor, int bufferSize) throws java.io.IOException
processor
- The IncrementalProcessor
used to perform
the processing. This should be constructed but not
initialised.bufferSize
- The internal buffer size.
java.io.IOException
- If there is an I/O problem.Method Detail |
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] bytes, int start, int length) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |