Java Unzip ZipEntry unzipEntry(ZipInputStream zin, File f)

Here you can find the source of unzipEntry(ZipInputStream zin, File f)

Description

unzip Entry

License

Open Source License

Declaration

static protected void unzipEntry(ZipInputStream zin, File f) throws IOException 

Method Source Code


//package com.java2s;
/*/*  w  w  w.j  av a  2  s.c o  m*/
  Part of the Processing project - http://processing.org
    
  Copyright (c) 2012-15 The Processing Foundation
  Copyright (c) 2004-12 Ben Fry and Casey Reas
    
  This program is free software; you can redistribute it and/or
  modify it under the terms of the GNU General Public License
  version 2, as published by the Free Software Foundation.
    
  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, write to the Free Software Foundation,
  Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

import java.io.*;

import java.util.zip.*;

public class Main {
    static protected void unzipEntry(ZipInputStream zin, File f) throws IOException {
        FileOutputStream out = new FileOutputStream(f);
        byte[] b = new byte[512];
        int len = 0;
        while ((len = zin.read(b)) != -1) {
            out.write(b, 0, len);
        }
        out.flush();
        out.close();
    }
}

Related

  1. unzipEntry(ZipFile zipFile, ZipEntry entry, File entryTarget)
  2. unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir)
  3. unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir)
  4. unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDirectory)
  5. unzipEntry(ZipInputStream zis, File newFile)
  6. unzipEntry(ZipInputStream zis, File out)
  7. unzipEntry(ZipInputStream zis, File targetFile)
  8. unzipEntryToFolder(ZipEntry entry, InputStream zis, File destFolder)