The DeflaterOutputStream and InflaterInputStream classes provide mechanism to compress and uncompress the data in thedeflate compression format.
DeflaterOutputStream class:
The DeflaterOutputStream class is used to compress the data in the deflate compression format. It provides facility to the other compression filters, such as GZIPOutputStream.
Example of Compressing file using DeflaterOutputStream class
In this example, we are reading data of a file and compressing it into another file using DeflaterOutputStream class. You can compress any file, here we are compressing the Deflater.java file
InflaterInputStream class:
The InflaterInputStream class is used to uncompress the file in the deflate compression format. It provides facility to the other uncompression filters, such as GZIPInputStream class.
Example of uncompressing file using InflaterInputStream class
In this example, we are decompressing the compressed file def.txt into D.java .
No comments:
Post a Comment