Here you can find the source of unzip(File intoFolder, ZipFile zipFile)
public static void unzip(File intoFolder, ZipFile zipFile) throws FileNotFoundException, IOException
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; public class Main { public static void unzip(File intoFolder, ZipFile zipFile) throws FileNotFoundException, IOException { Enumeration<?> enu = zipFile.entries(); while (enu.hasMoreElements()) { ZipEntry zipEntry = (ZipEntry) enu.nextElement(); String name = zipEntry.getName(); String nameFixed = name.replaceAll("\\\\", "/"); //long size = zipEntry.getSize(); //long compressedSize = zipEntry.getCompressedSize(); ///System.out.printf("name: %-20s | size: %6d | compressed size: %6d\n", // name, size, compressedSize); File file = new File(intoFolder, nameFixed); if (nameFixed.endsWith("/")) { file.mkdirs();//from w w w. j a v a 2 s . co m continue; } File parent = file.getParentFile(); if (parent != null) { parent.mkdirs(); } InputStream is = zipFile.getInputStream(zipEntry); FileOutputStream fos = new FileOutputStream(file); byte[] bytes = new byte[1024]; int length; while ((length = is.read(bytes)) >= 0) { fos.write(bytes, 0, length); } is.close(); fos.close(); } zipFile.close(); } }