Here you can find the source of unzipSingleEntry(ZipInputStream zin, File toFile)
private static void unzipSingleEntry(ZipInputStream zin, File toFile) throws IOException
//package com.java2s; /*//w ww . j av a2s . com Copyright (c) 2011 Robin Vobruba <hoijui.quaero@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.util.zip.ZipInputStream; public class Main { /** * Will unzip next entry from given ZipInputStream */ private static void unzipSingleEntry(ZipInputStream zin, File toFile) throws IOException { FileOutputStream out = null; try { out = new FileOutputStream(toFile); byte[] b = new byte[512]; int len = 0; while ((len = zin.read(b)) != -1) { out.write(b, 0, len); } } finally { out.close(); } } }