public class ChunkedOutputStream extends OutputStream
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.
| Constructor and Description |
|---|
ChunkedOutputStream(SessionOutputBuffer buffer,
OutputStream outputStream,
int chunkSizeHint)
Constructor with no trailers.
|
ChunkedOutputStream(SessionOutputBuffer buffer,
OutputStream outputStream,
int chunkSizeHint,
Supplier<List<? extends Header>> trailerSupplier)
Default constructor.
|
| Modifier and Type | Method and Description |
|---|---|
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 content buffer and the underlying stream.
|
void |
write(byte[] b)
Writes the array.
|
void |
write(byte[] src,
int off,
int len)
Writes the array.
|
void |
write(int b) |
public ChunkedOutputStream(SessionOutputBuffer buffer, OutputStream outputStream, int chunkSizeHint, Supplier<List<? extends Header>> trailerSupplier)
buffer - Session output bufferoutputStream - Output streamchunkSizeHint - minimal chunk size hinttrailerSupplier - Trailer supplier. May be nullpublic ChunkedOutputStream(SessionOutputBuffer buffer, OutputStream outputStream, int chunkSizeHint)
buffer - Session output bufferoutputStream - Output streamchunkSizeHint - minimal chunk size hintpublic void finish()
throws IOException
IOException - in case of an I/O errorpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] src,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionCopyright © 2005–2021 The Apache Software Foundation. All rights reserved.