Here you can find the source of unpack(File zippedFile, File unpackedFile)
public static String unpack(File zippedFile, File unpackedFile)
//package com.java2s; import java.io.BufferedInputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.Scanner; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { public static String unpack(File zippedFile, File unpackedFile) { long start = System.currentTimeMillis(); FileInputStream is;/*from w w w.j a v a 2 s . c o m*/ ZipInputStream zis; String content = null; try { is = new FileInputStream(zippedFile); zis = new ZipInputStream(new BufferedInputStream(is)); ZipEntry ze; byte[] buffer = new byte[1024]; int count; while ((ze = zis.getNextEntry()) != null) { FileOutputStream fout = new FileOutputStream(unpackedFile); while ((count = zis.read(buffer)) != -1) { fout.write(buffer, 0, count); } fout.close(); zis.closeEntry(); } zis.close(); content = new Scanner(unpackedFile).useDelimiter("\\A").next(); } catch (IOException e) { e.printStackTrace(); return null; } long end = System.currentTimeMillis(); System.out.println("###----> Unpack zip zippedFile, elapsed ms: " + (end - start)); return content; } }