Compressing and Decompressing FileThe DeflaterOutputStream and InflaterInputStream classes provide mechanism to compress and decompress the data in the deflate compression format. DeflaterOutputStream classThe 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 classIn 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 classThe 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 classIn this example, we are decompressing the compressed file def.txt into D.java . |