Here you can find the source of unzip(InputStream libInputStream, String path)
public static void unzip(InputStream libInputStream, String path) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { public static void unzip(InputStream libInputStream, String path) throws IOException { createFolder(path);/*from w w w. j av a 2 s . co m*/ ZipInputStream zis = new ZipInputStream(libInputStream); try { ZipEntry ze; byte[] buffer = new byte[4096]; while ((ze = zis.getNextEntry()) != null) { if (ze.isDirectory()) continue; String fileName = ze.getName(); int bytesRead; String filePath = path + File.separator + fileName; FileOutputStream fos = null; try { fos = new FileOutputStream(filePath); while ((bytesRead = zis.read(buffer)) > 0) { fos.write(buffer, 0, bytesRead); } } catch (IOException ioe) { ioe.printStackTrace(); } finally { if (fos != null) { fos.flush(); fos.close(); } zis.closeEntry(); } } } catch (IOException e) { e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. } finally { if (zis != null) zis.close(); } } private static void createFolder(String path) { File file = new File(path); if (!file.exists()) file.mkdirs(); } public static void close(OutputStream os) throws IOException { if (os != null) os.close(); } public static void close(Writer w) throws IOException { if (w != null) w.close(); } public static void close(RandomAccessFile raf) throws IOException { if (raf != null) raf.close(); } public static void close(BufferedReader br) throws IOException { br.close(); } }