Note that this class NEVER closes the underlying stream, even when
close() gets called. Instead, the stream will be marked as
closed and no further output will be permitted.
| Modifier and Type | Field and Description |
|---|---|
| private final SessionOutputBuffer | |
| private final byte[] | |
| private int | |
| private boolean | |
| private final CharArrayBuffer | |
| private final OutputStream | |
| private final Supplier | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | ChunkedOutputStream(final SessionOutputBuffer
Session output buffer buffer, final OutputStream Output stream outputStream, final byte[] Buffer used to aggregate smaller writes into chunks. chunkCache, final Supplier<List<? extends Header>> Trailer supplier. May be trailerSupplier)nullDefault constructor. |
| public | ChunkedOutputStream(final SessionOutputBuffer
Session output buffer buffer, final OutputStream Output stream outputStream, final int minimal chunk size hint chunkSizeHint, final Supplier<List<? extends Header>> Trailer supplier. May be trailerSupplier)nullConstructor taking an integer chunk size hint. |
| public | ChunkedOutputStream(final SessionOutputBuffer
Session output buffer buffer, final OutputStream Output stream outputStream, final int minimal chunk size hint chunkSizeHint)Constructor with no trailers. |
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Overrides java. Implements java. |
| public void | |
| public void | flush()
Overrides java. Implements java. |
| private void | |
| private void | flushCacheWithAppend(final byte[] bufferToAppend, final int off, final int len)
Writes the cache and bufferToAppend to the underlying stream as one large chunk |
| public void | write(final int
the b)byte.Implements abstract java. |
| public void | |
| public void | write(final byte[]
the data. src, final int the start offset in the data. off, final int the number of bytes to write. len)Overrides java. |
| private void | |
| private void |
| buffer | back to summary |
|---|---|
| private final SessionOutputBuffer buffer | |
| cache | back to summary |
|---|---|
| private final byte[] cache | |
| cachePosition | back to summary |
|---|---|
| private int cachePosition | |
| closed | back to summary |
|---|---|
| private boolean closed | |
| lineBuffer | back to summary |
|---|---|
| private final CharArrayBuffer lineBuffer | |
| outputStream | back to summary |
|---|---|
| private final OutputStream outputStream | |
| trailerSupplier | back to summary |
|---|---|
| private final Supplier<List<? extends Header>> trailerSupplier | |
| wroteLastChunk | back to summary |
|---|---|
| private boolean wroteLastChunk | |
| ChunkedOutputStream | back to summary |
|---|---|
| public ChunkedOutputStream(final SessionOutputBuffer buffer, final OutputStream outputStream, final byte[] chunkCache, final Supplier<List<? extends Header>> trailerSupplier) Default constructor.
| |
| ChunkedOutputStream | back to summary |
|---|---|
| public ChunkedOutputStream(final SessionOutputBuffer buffer, final OutputStream outputStream, final int chunkSizeHint, final Supplier<List<? extends Header>> trailerSupplier) Constructor taking an integer chunk size hint.
| |
| ChunkedOutputStream | back to summary |
|---|---|
| public ChunkedOutputStream(final SessionOutputBuffer buffer, final OutputStream outputStream, final int chunkSizeHint) Constructor with no trailers.
| |
| close | back to summary |
|---|---|
| public void close() throws IOException Overrides java. Implements java. Finishes writing to the underlying stream, but does NOT close the underlying stream.
| |
| finish | back to summary |
|---|---|
| public void finish() throws IOException Must be called to ensure the internal cache is flushed and the closing chunk is written.
| |
| flush | back to summary |
|---|---|
| public void flush() throws IOException Overrides java. Implements java. Flushes the content buffer and the underlying stream.
| |
| flushCache | back to summary |
|---|---|
| private void flushCache() throws IOException Writes the cache out onto the underlying stream | |
| flushCacheWithAppend | back to summary |
|---|---|
| private void flushCacheWithAppend(final byte[] bufferToAppend, final int off, final int len) throws IOException Writes the cache and bufferToAppend to the underlying stream as one large chunk | |
| write | back to summary |
|---|---|
| public void write(final int b) throws IOException Implements abstract java. Doc from java. Writes the specified byte to this output stream. The general
contract for
| |
| write | back to summary |
|---|---|
| public void write(final byte[] b) throws IOException Overrides java. Writes the array. If the array does not fit within the buffer, it is not split, but rather written out as one large chunk.
| |
| write | back to summary |
|---|---|
| public void write(final byte[] src, final int off, final int len) throws IOException Overrides java. Writes the array. If the array does not fit within the buffer, it is not split, but rather written out as one large chunk.
| |
| writeClosingChunk | back to summary |
|---|---|
| private void writeClosingChunk() throws IOException | |
| writeTrailers | back to summary |
|---|---|
| private void writeTrailers() throws IOException | |