Here you can find the source of unZip(File srcFile, File targetFile)
@SuppressWarnings("resource") public static void unZip(File srcFile, File targetFile)
//package com.java2s; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipInputStream; public class Main { @SuppressWarnings("resource") public static void unZip(File srcFile, File targetFile) { if (!srcFile.exists()) return; if (!targetFile.getParentFile().exists()) targetFile.getParentFile().mkdir(); while (true) { FileOutputStream localFileOutputStream; byte[] arrayOfByte; int i; try { FileInputStream localFileInputStream = new FileInputStream( srcFile);/* w ww . j a va2 s. c om*/ localFileOutputStream = new FileOutputStream(targetFile); ZipInputStream localZipInputStream = new ZipInputStream( localFileInputStream); arrayOfByte = new byte[1024]; i = localZipInputStream.read(arrayOfByte); if (i <= 0) { localFileInputStream.close(); localFileOutputStream.close(); return; } } catch (Exception localException) { localException.printStackTrace(); return; } try { localFileOutputStream.write(arrayOfByte, 0, i); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }