Here you can find the source of unzip(File archiveFile, File destination)
public static void unzip(File archiveFile, File destination) throws Exception
//package com.java2s; //License from project: Apache License import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { private static final int BUFFER = 2048; public static void unzip(File archiveFile, File destination) throws Exception { try {/* w w w .ja va 2s. co m*/ BufferedOutputStream dest = null; FileInputStream fis = new FileInputStream(archiveFile); ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis)); ZipEntry entry; File base = destination; while ((entry = zis.getNextEntry()) != null) { int count; byte data[] = new byte[BUFFER]; File file = new File(base, entry.getName()); if (entry.getName().endsWith("/")) { file.mkdirs(); continue; } if (file.getParentFile() != null && !file.getParentFile().exists()) file.getParentFile().mkdirs(); FileOutputStream fos = new FileOutputStream(file); dest = new BufferedOutputStream(fos, BUFFER); while ((count = zis.read(data, 0, BUFFER)) != -1) { dest.write(data, 0, count); } dest.flush(); dest.close(); } zis.close(); fis.close(); } catch (Exception e) { throw e; } } }