In this tutorial, we will discuss about getBytesRead(), getByteWritten() and
method of Inflater class. The Inflater
class provide support for Decompression using ZLIB library. The getBytesRead()
method returns total number of compressed bytes of input stream read by
inflater. It works same as getTotalIn(), but returns long instead
of integer. The getByteWritten() method returns total number of Uncompressed bytes..
It works same as getTotalOut(), but returns long instead of
integer. The getRemaining() method returns total number of bytes remains
in associated input buffer..
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 java.util.zip.Inflater class extends java.lang.Object class. It provid following method:
|long||getBytesRead()||Function getBytesRead() returns number of compress bytes from associated input stream.|
|long||getTotalWritten()||Function getBytesWritten() returns number of Uncompress bytes from associated output stream.|
|int||getRemaining()||The getRemaining() method returns total number of bytes remains in associated input buffer.|
Compressed file : testfile.txt
Number of bytes of Compressed data : 19bytes
Remaining bytes after decompression data : 0bytes
Number of bytes of Uncompressed data : 59bytes
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.