public class BlockCompressorStream extends CompressorStream
CompressorStream
which works
with 'block-based' based compression algorithms, as opposed to
'stream-based' compression algorithms.
It should be noted that this wrapper does not guarantee that blocks will
be sized for the compressor. If the
Compressor
requires buffering to
effect meaningful compression, it is responsible for it.buffer, closed, compressor
out
构造器和说明 |
---|
BlockCompressorStream(OutputStream out,
Compressor compressor)
Create a
BlockCompressorStream with given output-stream and
compressor. |
BlockCompressorStream(OutputStream out,
Compressor compressor,
int bufferSize,
int compressionOverhead)
Create a
BlockCompressorStream . |
限定符和类型 | 方法和说明 |
---|---|
protected void |
compress() |
void |
finish()
Finishes writing compressed data to the output stream
without closing the underlying stream.
|
void |
write(byte[] b,
int off,
int len)
Write the data provided to the compression codec, compressing no more
than the buffer size less the compression overhead as specified during
construction for each block.
|
close, resetState, write
flush
write
public BlockCompressorStream(OutputStream out, Compressor compressor, int bufferSize, int compressionOverhead)
BlockCompressorStream
.out
- streamcompressor
- compressor to be usedbufferSize
- size of buffercompressionOverhead
- maximum 'overhead' of the compression
algorithm with given bufferSizepublic BlockCompressorStream(OutputStream out, Compressor compressor)
BlockCompressorStream
with given output-stream and
compressor.
Use default of 512 as bufferSize and compressionOverhead of
(1% of bufferSize + 12 bytes) = 18 bytes (zlib algorithm).out
- streamcompressor
- compressor to be usedpublic void write(byte[] b, int off, int len) throws IOException
write
在类中 CompressorStream
IOException
public void finish() throws IOException
CompressionOutputStream
finish
在类中 CompressorStream
IOException
protected void compress() throws IOException
compress
在类中 CompressorStream
IOException
Copyright © 2009 The Apache Software Foundation