Javatpoint Logo
Javatpoint Logo

Compressing and Decompressing File

The DeflaterOutputStream and InflaterInputStream classes provide mechanism to compress and decompress the data in the deflate 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 decompress the file in the deflate compression format. It provides facility to the other decompression filters, such as GZIPInputStream class.

Example of decompressing file using InflaterInputStream class

In this example, we are decompressing the compressed file def.txt into D.java .






Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA