|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.io.OutputStream org.apache.commons.httpclient.ChunkedOutputStream
public class ChunkedOutputStream
Implements HTTP chunking support. Writes are buffered to an internal buffer (2048 default size). Chunks are guaranteed to be at least as large as the buffer size (except for the last chunk).
Constructor Summary | |
---|---|
ChunkedOutputStream(OutputStream stream)
Wraps a stream and chunks the output. |
|
ChunkedOutputStream(OutputStream stream,
int bufferSize)
Wraps a stream and chunks the output. |
Method Summary | |
---|---|
void |
close()
Finishes writing to the underlying stream, but does NOT close the underlying stream. |
void |
finish()
Must be called to ensure the internal cache is flushed and the closing chunk is written. |
void |
flush()
Flushes the underlying stream, but leaves the internal buffer alone. |
protected void |
flushCache()
Writes the cache out onto the underlying stream |
protected void |
flushCacheWithAppend(byte[] bufferToAppend,
int off,
int len)
Writes the cache and bufferToAppend to the underlying stream as one large chunk |
void |
write(byte[] b)
Writes the array. |
void |
write(byte[] src,
int off,
int len)
|
void |
write(int b)
Write the specified byte to our output stream. |
protected void |
writeClosingChunk()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ChunkedOutputStream(OutputStream stream, int bufferSize)
stream
- to wrapbufferSize
- minimum chunk size (excluding last chunk)public ChunkedOutputStream(OutputStream stream)
stream
- Method Detail |
---|
protected void flushCache() throws IOException
IOException
protected void flushCacheWithAppend(byte[] bufferToAppend, int off, int len) throws IOException
bufferToAppend
- off
- len
-
IOException
protected void writeClosingChunk() throws IOException
IOException
public void finish() throws IOException
IOException
public void write(int b) throws IOException
write
in class OutputStream
b
- The byte to be written
IOException
- if an input/output error occurspublic void write(byte[] b) throws IOException
write
in class OutputStream
b
-
IOException
public void write(byte[] src, int off, int len) throws IOException
write
in class OutputStream
IOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in class OutputStream
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |