| java.lang.Object java.io.OutputStream org.apache.http.impl.io.ChunkedOutputStream
ChunkedOutputStream | public class ChunkedOutputStream extends OutputStream (Code) | | Implements chunked transfer coding.
See RFC 2616,
section 3.6.1.
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).
author: Mohammad Rezaei (Goldman, Sachs & Co.) author: Oleg Kalnichevski since: 4.0 |
Method Summary | |
public void | close() Finishes writing to the underlying stream, but does NOT close the underlying stream. | public void | finish() Must be called to ensure the internal cache is flushed and the closing chunk is written. | public void | flush() Flushes the underlying stream, but leaves the internal buffer alone. | protected void | flushCache() | protected void | flushCacheWithAppend(byte bufferToAppend, int off, int len) | public void | write(int b) | public void | write(byte b) Writes the array. | public void | write(byte src, int off, int len) | protected void | writeClosingChunk() |
ChunkedOutputStream | public ChunkedOutputStream(SessionOutputBuffer out, int bufferSize) throws IOException(Code) | | Wraps a session output buffer and chunks the output.
Parameters: out - the session output buffer to wrap Parameters: bufferSize - minimum chunk size (excluding last chunk) throws: IOException - |
ChunkedOutputStream | public ChunkedOutputStream(SessionOutputBuffer out) throws IOException(Code) | | Wraps a session output buffer and chunks the output. The default buffer
size of 2048 was chosen because the chunk overhead is less than 0.5%
Parameters: out - the output buffer to wrap throws: IOException - |
close | public void close() throws IOException(Code) | | Finishes writing to the underlying stream, but does NOT close the underlying stream.
throws: IOException - |
finish | public void finish() throws IOException(Code) | | Must be called to ensure the internal cache is flushed and the closing chunk is written.
throws: IOException - |
flush | public void flush() throws IOException(Code) | | Flushes the underlying stream, but leaves the internal buffer alone.
throws: IOException - |
flushCacheWithAppend | protected void flushCacheWithAppend(byte bufferToAppend, int off, int len) throws IOException(Code) | | Writes the cache and bufferToAppend to the underlying stream
as one large chunk
Parameters: bufferToAppend - Parameters: off - Parameters: len - throws: IOException - |
write | public void write(byte b) throws IOException(Code) | | Writes the array. If the array does not fit within the buffer, it is
not split, but rather written out as one large chunk.
Parameters: b - throws: IOException - |
|
|