In this tutorial, we will discuss about getTotalIn() and getTotalOut()
method of Inflater class. The Inflater
class provide support for Decompression using ZLIB library. The
Inflater class is available in java.util.zip package.The getTotalIn()
method returns total number of compressed bytes of input stream. The getTotalOut()
method returns total number of Uncompressed bytes of output stream.
In the given Example, we will discuss about the Inflater class which is used for decompression. 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 getTotalIn() method returns total number of compressed bytes of input stream. The read() method of InflaterInputStream class read uncompressed data into array of bytes. The getTotalOut() method returns total number of Uncompressed bytes of output stream.
The java.util.zip.Inflater class extends java.lang.Object class. It provid following method:
|int||getTotalIn()||Function getTotalIn() returns number of compress bytes from associated input stream.|
|int||getTotalOut()||Function getTotalOut() returns number of Uncompress bytes from associated output stream.|
|void||close()||The close() method close input stream and releases system resources.|
Compressed file : testfile.txt
Actual Size of compressed data :19
Uncompressed file : zip.txt
Actual Size of Uncompressed data :59
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.