public class ChunkedOutputStream extends OutputStream
| 构造器和说明 |
|---|
ChunkedOutputStream(OutputStream stream)
Wraps a stream and chunks the output.
|
ChunkedOutputStream(OutputStream stream,
int bufferSize)
Wraps a stream and chunks the output.
|
| 限定符和类型 | 方法和说明 |
|---|---|
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() |
public ChunkedOutputStream(OutputStream stream, int bufferSize) throws IOException
stream - to wrapbufferSize - minimum chunk size (excluding last chunk)IOExceptionpublic ChunkedOutputStream(OutputStream stream) throws IOException
stream - IOExceptionprotected void flushCache()
throws IOException
IOExceptionprotected void flushCacheWithAppend(byte[] bufferToAppend,
int off,
int len)
throws IOException
bufferToAppend - off - len - IOExceptionprotected void writeClosingChunk()
throws IOException
IOExceptionpublic void finish()
throws IOException
IOExceptionpublic void write(int b)
throws IOException
write 在类中 OutputStreamb - The byte to be writtenIOException - if an input/output error occurspublic void write(byte[] b)
throws IOException
write 在类中 OutputStreamb - IOExceptionpublic 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 © 2017. All rights reserved.