Java tutorial
//package com.java2s; //License from project: Apache License import java.io.BufferedOutputStream; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipInputStream; public class Main { private static void fileUnZip(ZipInputStream zis, File file) throws FileNotFoundException, IOException { java.util.zip.ZipEntry zip = null; while ((zip = zis.getNextEntry()) != null) { String name = zip.getName(); File f = new File(file.getAbsolutePath() + File.separator + name); if (zip.isDirectory()) { f.mkdirs(); } else { f.getParentFile().mkdirs(); f.createNewFile(); BufferedOutputStream bos = null; try { bos = new BufferedOutputStream(new FileOutputStream(f)); byte b[] = new byte[2048]; int aa = 0; while ((aa = zis.read(b)) != -1) { bos.write(b, 0, aa); } bos.flush(); } finally { bos.close(); } bos.close(); } } } }