Java GZIP Example - Compress and Decompress File

Welcome to Java GZIP example. GZIP is one of the favorite tool to compress file in Unix systems. We can compress a single file in GZIP format but we can’t compress and archive a directory using GZIP like ZIP files.

Java GZIP

Here is a simple java GZIP example program showing how can we compress a file to GZIP format and then decompress the GZIP file to create a new file.

GZIPExample.java

While decompressing a GZIP file, if it’s not in GZIP format, following exception will be thrown.

That’s all for Java GZIP Example.

By admin

Leave a Reply