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.
| 构造器和说明 |
|---|
ChunkedOutputStream(SessionOutputBuffer buffer,
OutputStream outputStream,
byte[] chunkCache,
Supplier<List<? extends Header>> trailerSupplier)
Default constructor.
|
ChunkedOutputStream(SessionOutputBuffer buffer,
OutputStream outputStream,
int chunkSizeHint)
Constructor with no trailers.
|
ChunkedOutputStream(SessionOutputBuffer buffer,
OutputStream outputStream,
int chunkSizeHint,
Supplier<List<? extends Header>> trailerSupplier)
Constructor taking an integer chunk size hint.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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, byte[] chunkCache, Supplier<List<? extends Header>> trailerSupplier)
buffer - Session output bufferoutputStream - Output streamchunkCache - Buffer used to aggregate smaller writes into chunks.trailerSupplier - Trailer supplier. May be nullpublic 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 在类中 OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write 在类中 OutputStreamIOExceptionpublic void write(byte[] src,
int off,
int len)
throws IOException
write 在类中 OutputStreamIOExceptionpublic void flush()
throws IOException
flush 在接口中 Flushableflush 在类中 OutputStreamIOExceptionpublic void close()
throws IOException
close 在接口中 Closeableclose 在接口中 AutoCloseableclose 在类中 OutputStreamIOExceptionCopyright © 2023. All rights reserved.