- java.util.zip - ZipOutputStream
- java.util.zip - ZipInputStream
- java.util.zip - ZipFile
- java.util.zip - ZipEntry
- java.util.zip - InflaterOutputStream
- java.util.zip - InflaterInputStream
- java.util.zip - Inflater
- java.util.zip - GZIPOutputStream
- java.util.zip - GZIPInputStream
- java.util.zip - DeflaterOutputStream
- java.util.zip - DeflaterInputStream
- java.util.zip - Deflater
- java.util.zip - CRC32
- java.util.zip - CheckedOutputStream
- java.util.zip - CheckedInputStream
- java.util.zip - Adler32
- java.util.zip - Home
java.util.zip Package Extras
- java.util.zip - Discussion
- java.util.zip - Useful Resources
- java.util.zip - Quick Guide
- java.util.zip - Error
- java.util.zip - Exceptions
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
java.util.zip - Deflater Class
Introduction
The java.util.zip.Deflater class provides support for general purpose compression using the popular ZLIB compression pbrary. The ZLIB compression pbrary was initially developed as part of the PNG graphics standard and is not protected by patents. It is fully described in the specifications at the java.util.zip package description.
Class declaration
Following is the declaration for java.util.zip.Deflater class −
pubpc class Deflater extends Object
Fields
Following are the fields for java.util.zip.Deflater class −
static int BEST_COMPRESSION − Compression level for best compression.
static int BEST_SPEED − Compression level for fastest compression.
static int DEFAULT_COMPRESSION − Default compression level.
static int DEFAULT_STRATEGY − Default compression strategy.
static int DEFLATED − Compression method for the deflate algorithm (the only one currently supported).
static int FILTERED − Compression strategy best used for data consisting mostly of small values with a somewhat random distribution.
static int FULL_FLUSH − Compression flush mode used to flush out all pending output and reset the deflater.
static int HUFFMAN_ONLY − Compression strategy for Huffman coding only.
static int NO_COMPRESSION − Compression level for no compression.
static int NO_FLUSH − Compression flush mode used to achieve best compression result.
static int SYNC_FLUSH − Compression flush mode used to flush out all pending output; may degrade compression for some compression algorithms.
Constructors
Sr.No. | Constructor & Description |
---|---|
1 | Deflater() Creates a new compressor with the default compression level. |
2 | Deflater(int level) Creates a new compressor using the specified compression level. |
3 | Deflater(int level, boolean nowrap) Creates a new compressor using the specified compression level. |
Class methods
Sr.No. | Method & Description |
---|---|
1 | Compresses the input data and fills specified buffer with compressed data. |
2 | Compresses the input data and fills specified buffer with compressed data. |
3 | Compresses the input data and fills the specified buffer with compressed data. |
4 | Closes the compressor and discards any unprocessed input. |
5 | When called, indicates that compression should end with the current contents of the input buffer. |
6 | Returns true if the end of the compressed data output stream has been reached. |
7 | Returns the ADLER-32 value of the uncompressed data. |
8 | Returns the total number of uncompressed bytes input so far. |
9 | Returns the total number of compressed bytes output so far. |
10 | Returns the total number of uncompressed bytes input so far. |
11 | Returns the total number of compressed bytes output so far. |
12 | Returns true if the input data buffer is empty and setInput() should be called in order to provide more input. |
13 | Resets deflater so that a new set of input data can be processed. |
14 | Sets preset dictionary for compression. |
15 | Sets preset dictionary for compression. |
16 | Sets input data for compression. |
17 | Sets input data for compression. |
18 | Sets the current compression level to the specified value. |
19 | Sets the compression strategy to the specified value. |
Methods inherited
This class inherits methods from the following classes −
java.lang.Object