Here you can find the source of uncompress(String inputFile, String toDir)
public static void uncompress(String inputFile, String toDir) throws ZipException
//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.zip.CRC32; import java.util.zip.CheckedInputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipException; import java.util.zip.ZipInputStream; public class Main { private static final int BUFFER = 2048; public static void uncompress(String inputFile, String toDir) throws ZipException { try {/*from w w w .ja v a 2s .co m*/ FileInputStream tin = new FileInputStream(inputFile); CheckedInputStream cin = new CheckedInputStream(tin, new CRC32()); BufferedInputStream bufferIn = new BufferedInputStream(cin, BUFFER); ZipInputStream in = new ZipInputStream(bufferIn); ZipEntry z = in.getNextEntry(); while (z != null) { String name = z.getName(); if (z.isDirectory()) { File f = new File(toDir + File.separator + name); f.mkdir(); } else { File f = new File(toDir + File.separator + name); f.createNewFile(); FileOutputStream out = new FileOutputStream(f); byte data[] = new byte[BUFFER]; int b; while ((b = in.read(data, 0, BUFFER)) != -1) { out.write(data, 0, b); } out.close(); } z = in.getNextEntry(); } in.close(); } catch (IOException ex) { throw new ZipException(ex.getMessage()); } } }