public class ZCompressorOutputStream
extends java.io.FilterOutputStream
OutputStream
that will compress data
as it writes to another OutputStream. Not thread safe.ZCompressor
Constructor and Description |
---|
ZCompressorOutputStream(ZCompressor compressor,
java.io.OutputStream out)
Create a new output stream with default buffer size.
|
ZCompressorOutputStream(ZCompressor compressor,
java.io.OutputStream out,
int buflen)
Create a new output stream with the specified buffer size.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
This method also flushes data, including any partially compressed last byte.
|
void |
flush()
This flushes the buffer of all compressed data, excluding a possible partial last byte.
|
long |
getTotalCompressedBytes()
Answer the total number of compressed bytes written so far.
|
long |
getTotalSourceBytes()
Answer the total number of input (uncompressed) bytes written so far.
|
void |
releaseZCompressorOnClose(boolean value)
Sets a flag that will cause the ZCompressor resources to be released
when this OutputStream is closed.
|
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
public ZCompressorOutputStream(ZCompressor compressor, java.io.OutputStream out)
compressor
- the ZCompressor object used to compress dataout
- the target OutputStream for compressed datapublic ZCompressorOutputStream(ZCompressor compressor, java.io.OutputStream out, int buflen)
compressor
- the ZCompressor object used to compress dataout
- the target OutputStream for compressed databuflen
- internal buffer for compressed datapublic void releaseZCompressorOnClose(boolean value)
false
.public long getTotalSourceBytes()
public long getTotalCompressedBytes()
public void write(byte[] b, int off, int len) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
OutputStream.write(byte[], int, int)
public void write(int b) throws java.io.IOException
write
in class java.io.FilterOutputStream
java.io.IOException
OutputStream.write(int)
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.FilterOutputStream
java.io.IOException
OutputStream.close()
public void flush() throws java.io.IOException
flush
in interface java.io.Flushable
flush
in class java.io.FilterOutputStream
java.io.IOException
OutputStream.flush()