In this tutorial, you see use of getBytesRead, getByteWritten and getRemaining method of Inflater class in java.
In this tutorial, you see use of getBytesRead, getByteWritten and getRemaining method of Inflater class in java.In this tutorial, we will discuss about getBytesRead(), getByteWritten() and
getRemaining()
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:
Return Type | Method | Description |
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. |
import java.io.*;
|
C:\>java InflaterGetBytes Compressed file : testfile.txt Number of bytes of Compressed data : 19bytes Remaining bytes after decompression data : 0bytes Number of bytes of Uncompressed data : 59bytes |