public class SpeedyChunkedInputStream
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
DefaultBufferSize |
protected java.io.InputStream |
is |
protected boolean |
isClosed |
static int |
MaxBufferSize |
Constructor and Description |
---|
SpeedyChunkedInputStream(java.io.InputStream stream)
Wraps an input stream and interprets it as a chunked stream.
|
SpeedyChunkedInputStream(java.io.InputStream stream,
ChunkProtocol chunkProtocol)
Wraps an input stream and interprets it as a chunked stream.
|
Modifier and Type | Method and Description |
---|---|
int |
available() |
int |
availableInChunk() |
void |
close() |
int |
getCurrentChunkType() |
boolean |
isLastChunk() |
boolean |
processChunk(java.io.OutputStream dStream,
java.io.OutputStream errStream) |
boolean |
readChunk() |
boolean |
readChunkedMessage(java.io.OutputStream dStream,
java.io.OutputStream errStream)
Reads a chunked message from the underlying InputStream and transmits to the passed OutputStream,
dstream . |
int |
readChunkHeader()
Reads the next chunk header.
|
public static final int DefaultBufferSize
public static final int MaxBufferSize
protected java.io.InputStream is
protected boolean isClosed
public SpeedyChunkedInputStream(java.io.InputStream stream, ChunkProtocol chunkProtocol)
stream
- to wrapchunkProtocol
- the chunking protocolpublic SpeedyChunkedInputStream(java.io.InputStream stream)
stream
- to wrappublic int readChunkHeader() throws java.io.IOException
java.io.IOException
- When the underlying stream does, or if the header is boguspublic int getCurrentChunkType()
public int availableInChunk()
public int available() throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public boolean isLastChunk()
public boolean readChunk() throws java.io.IOException
java.io.IOException
public boolean processChunk(java.io.OutputStream dStream, java.io.OutputStream errStream) throws java.io.IOException
java.io.IOException
public boolean readChunkedMessage(java.io.OutputStream dStream, java.io.OutputStream errStream) throws java.io.IOException
dstream
. If an error condition is encountered in the chunked message then the error content
will be written to the OutputStream errStream
.dStream
- The stream into which to transfer the message data.errStream
- The stream into which to transfer error content if the
message contains it.java.io.IOException
- When there are problems reading from or interpreting
the chunked message stream.