Here you can find the source of unZip(File zipFile, String desdir)
public static void unZip(File zipFile, String desdir) throws IOException
//package com.java2s; //License from project: Apache License import java.io.BufferedOutputStream; import java.io.File; 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 zipFile, String desdir) throws IOException { ZipFile zip = new ZipFile(zipFile); Enumeration<?> en = zip.entries(); ZipEntry entry = null;// ww w .j av a 2 s. co m byte[] buffer = new byte[8192]; int length = -1; InputStream input = null; BufferedOutputStream bos = null; File file = null; while (en.hasMoreElements()) { entry = (ZipEntry) en.nextElement(); if (entry.isDirectory()) { continue; } input = zip.getInputStream(entry); file = new File(desdir, entry.getName()); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } bos = new BufferedOutputStream(new FileOutputStream(file)); while (true) { length = input.read(buffer); if (length == -1) break; bos.write(buffer, 0, length); } bos.close(); input.close(); } zip.close(); } }