Package com.oss.util
Class CompressOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.util.zip.DeflaterOutputStream
com.oss.util.CompressOutputStream
- All Implemented Interfaces:
Closeable
,Flushable
,AutoCloseable
This class extends CompressOutputStream and facilitates temporary
in-memory buffering of encoding. The buffering is used to insert
compression prefix before encoding prior to writing them to a target
output stream.
- Since:
- ASN.1/Java 5.1.0
-
Constructor Summary
ConstructorDescriptionConstructs CompressOutputStream with a default compressor and buffer size.CompressOutputStream
(OutputStream out, Deflater deflater) Constructs CompressOutputStream with the specified compressor and a default buffer size.CompressOutputStream
(OutputStream out, Deflater deflater, int size) Constructs CompressOutputStream with the specified compressor and buffer size. -
Method Summary
Methods inherited from class java.util.zip.DeflaterOutputStream
close, flush, write
Methods inherited from class java.io.FilterOutputStream
write
Methods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
CompressOutputStream
Constructs CompressOutputStream with a default compressor and buffer size.- Parameters:
out
- the output stream
-
CompressOutputStream
Constructs CompressOutputStream with the specified compressor and a default buffer size.- Parameters:
out
- the output streamdeflater
- the compressor ("deflater")
-
CompressOutputStream
Constructs CompressOutputStream with the specified compressor and buffer size.- Parameters:
out
- the output streamdeflater
- the compressor ("deflater")size
- the output buffer size- Throws:
IllegalArgumentException
- if size is <= 0 Constructs CompressOutputStream and attaches it to sink. Additionally specifies the initial capacity of the internal buffer and size increment to expand the buffer when its capacity is exhausted.
-
-
Method Details
-
write
Writes an array of bytes to the compressed output stream. This method will block until all the bytes are written.- Overrides:
write
in classDeflaterOutputStream
- Parameters:
b
- the data to be writtenoff
- the start offset of the datalen
- the length of the data- Throws:
IOException
- if an I/O error has occurred
-
finish
Finishes writing compressed data to the output stream without closing the underlying stream. Use this method when applying multiple filters in succession to the same output stream.- Overrides:
finish
in classDeflaterOutputStream
- Throws:
IOException
- if an I/O error has occurred
-