Java Unzip ZipEntry unzipEntry(ZipInputStream zis, File targetFile)

Here you can find the source of unzipEntry(ZipInputStream zis, File targetFile)

Description

unzip Entry

License

Open Source License

Declaration

protected static File unzipEntry(ZipInputStream zis, File targetFile) throws Exception 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.FileOutputStream;

import java.util.zip.ZipInputStream;

public class Main {
    private static final int BUFFER_SIZE = 1024 * 2;

    protected static File unzipEntry(ZipInputStream zis, File targetFile) throws Exception {
        FileOutputStream fos = null;
        try {//from www . j  a v a2  s  .c  o m
            fos = new FileOutputStream(targetFile);

            byte[] buffer = new byte[BUFFER_SIZE];
            int len = 0;
            while ((len = zis.read(buffer)) != -1) {
                fos.write(buffer, 0, len);
            }
        } finally {
            if (fos != null) {
                fos.close();
            }
        }
        return targetFile;
    }
}

Related

  1. unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDir)
  2. unzipEntry(ZipFile zipfile, ZipEntry entry, File outputDirectory)
  3. unzipEntry(ZipInputStream zin, File f)
  4. unzipEntry(ZipInputStream zis, File newFile)
  5. unzipEntry(ZipInputStream zis, File out)
  6. unzipEntryToFolder(ZipEntry entry, InputStream zis, File destFolder)
  7. unZipFile(File destFile, ZipFile zipFile, ZipEntry entry)
  8. unzipFile(ZipFile archive, File targetFile, ZipEntry entry)
  9. unzipSingleEntry(ZipInputStream zin, File toFile)