In this tutorial you will see the Use of getTotalIn and getTotalOut method of Inflater class in java.
In this tutorial you will see the Use of getTotalIn and getTotalOut method of Inflater class in java.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:
Return Type | Method | Description |
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. |
import java.io.File; |
C:\l>java InflaterGetTotal Compressed file : testfile.txt Actual Size of compressed data :19 Uncompressed file : zip.txt Actual Size of Uncompressed data :59 |