Here you can find the source of uncompressZipEntry(ZipInputStream zis, ZipEntry zipEntry, String dest)
private static long uncompressZipEntry(ZipInputStream zis, ZipEntry zipEntry, String dest) throws Exception
//package com.java2s; /*/*from w w w . j a va2 s .c o m*/ * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of the License "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * Deniz TURAN * Description: * */ import java.io.File; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; public class Main { private static long uncompressZipEntry(ZipInputStream zis, ZipEntry zipEntry, String dest) throws Exception { byte[] buf = new byte[1024]; String entryName = zipEntry.getName(); int n; File rootDir = new File(dest); FileOutputStream fileoutputstream; File newFile = new File(rootDir, entryName); long totalLen = 0; if (zipEntry.isDirectory()) { if (!newFile.exists()) { newFile.mkdir(); } return 0; } fileoutputstream = new FileOutputStream(newFile); while ((n = zis.read(buf, 0, 1024)) > -1) { fileoutputstream.write(buf, 0, n); totalLen += n; } fileoutputstream.close(); zis.closeEntry(); return totalLen; } }