In this tutorial, we will define the use of Inflater class. The Inflater
class provide support for Decompression using ZLIB library. The
Inflater class is available in java.util.zip package.The read(....) method read uncompressed data in
a bytes array.
In the given Example, we
will explain how to decompress file using Inflater class. The Inflater
class create a decompresser. The FileInputStream class creates a input
stream and read bytes from file. The
InflaterInputStream class creates a input stream with a given Inflater. It
reads data from stream and decompress. The read() method of InflaterInputStream
class read uncompressed data into array of bytes.
The java.util.zip.InflaterInputStream class extends java.util.zip.FilterOutputStream class. It provid following method:
| Return Type | Method | Description |
| int | read() | The read(....) method read uncompressed data in a bytes array. |
| void | close() | The close() method close input stream and releases system resources. |
import java.io.File;
|
| C:\>java InflaterDemo Compressed file : bharat.txt.dfl Dcompressed file : zip.txt |
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.