Here you can find the source of unzip(File zipfile, File directory)
private static void unzip(File zipfile, File directory) throws IOException
//package com.java2s; //License from project: LGPL import java.io.*; import java.util.Enumeration; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; public class Main { private static void unzip(File zipfile, File directory) throws IOException { ZipFile zfile = new ZipFile(zipfile); Enumeration<? extends ZipEntry> entries = zfile.entries(); while (entries.hasMoreElements()) { ZipEntry entry = entries.nextElement(); File file = new File(directory, entry.getName()); if (entry.isDirectory()) { file.mkdirs();// www.j ava2s .c o m } else { file.getParentFile().mkdirs(); final InputStream in = zfile.getInputStream(entry); final String path = directory.getPath(); new Thread(new Runnable() { @Override public void run() { try { try { copy(in, new File(path)); } finally { in.close(); } } catch (IOException ex) { } } }).start(); } } zfile.close(); } private static void copy(InputStream in, OutputStream out) throws IOException { byte[] buffer = new byte[1024]; while (true) { int readCount = in.read(buffer); if (readCount < 0) { break; } out.write(buffer, 0, readCount); } } public static void copy(InputStream in, File file) throws IOException { OutputStream out = new FileOutputStream(file); try { copy(in, out); } finally { out.close(); } } }