How to Decompress Files in Java – Zip Format

In this post we will see how to decompress files in java using ZIP format.
Java provides a complete package java.util.zip to perform compression/decompression.

Steps to decompress files in ZIP format

1. Create a ZipInputStream using a FileInputStream

2. Read all the Files that need to be unzipped using ZipEntry

3.Write data to each File using FileOutputStream and BufferedOutputStream

Example

We had alread created a ZIP file in the previous post – Zip Files using Java
Lets use the same ZIP and unZIP it to a new folder.

Output

How to Decompress files in Java