Here you can find the source of unzipFile(String zipFile, File outputFolder)
static void unzipFile(String zipFile, File outputFolder) throws IOException
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { /**// www.j a v a2 s . c o m * Unzip a file into a specified output folder */ static void unzipFile(String zipFile, File outputFolder) throws IOException { byte[] buffer = new byte[1024]; // create output directory is not exists if (!outputFolder.exists()) { outputFolder.mkdir(); } // get the zip file content ZipInputStream zis = new ZipInputStream( new FileInputStream(zipFile)); // get the zipped file list entry ZipEntry ze = zis.getNextEntry(); while (ze != null) { String fileName = ze.getName(); File newFile = new File(outputFolder + File.separator + fileName); System.out .println("Unzipping to: " + newFile.getAbsoluteFile()); // create all non existing folders // otherwise you will get FileNotFoundException for compressed folder if (ze.isDirectory()) { new File(newFile.getParent()).mkdirs(); } else { FileOutputStream fos = null; new File(newFile.getParent()).mkdirs(); fos = new FileOutputStream(newFile); int len; while ((len = zis.read(buffer)) > 0) { fos.write(buffer, 0, len); } fos.close(); } ze = zis.getNextEntry(); } zis.closeEntry(); zis.close(); System.out.println("Unzip complete"); } }