Package com.itextpdf.io.source
Class DeflaterOutputStream
java.lang.Object
java.io.OutputStream
java.io.FilterOutputStream
java.util.zip.DeflaterOutputStream
com.itextpdf.io.source.DeflaterOutputStream
- All Implemented Interfaces:
-
IFinishable,Closeable,Flushable,AutoCloseable
An output stream that compresses data using the DEFLATE compression algorithm. This is a wrapper around
DeflaterOutputStream that provides convenient constructors for specifying compression level and buffer size.
The compression level can be set to values between 0 (no compression) and 9 (maximum compression), or use -1 for the default compression level.
-
Field Summary
Fields inherited from class java.util.zip.DeflaterOutputStream
buf, defFields inherited from class java.io.FilterOutputStream
out -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new deflater output stream with default compression level and buffer size.DeflaterOutputStream(OutputStream out, int level) Creates a new deflater output stream with a specified compression level and default buffer size.DeflaterOutputStream(OutputStream out, int level, int size) Creates a new deflater output stream with a specified compression level and buffer size. -
Method Summary
Methods inherited from class java.util.zip.DeflaterOutputStream
deflate, flush, write, writeMethods inherited from class java.io.FilterOutputStream
writeMethods inherited from class java.io.OutputStream
nullOutputStream
-
Constructor Details
-
DeflaterOutputStream
Creates a new deflater output stream with a specified compression level and buffer size.- Parameters:
-
out- the output stream to write compressed data to -
level- the compression level (0-9, or -1 for default) -
size- the buffer size in bytes
-
DeflaterOutputStream
Creates a new deflater output stream with a specified compression level and default buffer size.- Parameters:
-
out- the output stream to write compressed data to -
level- the compression level (0-9, or -1 for default)
-
DeflaterOutputStream
Creates a new deflater output stream with default compression level and buffer size.- Parameters:
-
out- the output stream to write compressed data to
-
-
Method Details
-
close
Closes this output stream and releases any system resources associated with it. This method finishes writing compressed data to the output stream before closing.- Specified by:
-
closein interfaceAutoCloseable - Specified by:
-
closein interfaceCloseable - Overrides:
-
closein classDeflaterOutputStream - Throws:
-
IOException- if an I/O error occurs
-
finish
Finishes writing compressed data to the output stream without closing the underlying stream. This method completes the compression process and ends the deflater, releasing its resources.- Specified by:
-
finishin interfaceIFinishable - Overrides:
-
finishin classDeflaterOutputStream - Throws:
-
IOException- if an I/O error occurs
-