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:
|int||read()||The read(....) method read uncompressed data in a bytes array.|
|void||close()||The close() method close input stream and releases system resources.|
Compressed file : bharat.txt.dfl
Dcompressed file : zip.txt
Posted on: July 16, 2010 If you enjoyed this post then why not add us on Google+? Add us to your Circles