Android ZipInputStream Save 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

private static final File unzipEntry(ZipInputStream zis, File targetFile)
            throws IOException 

Method Source Code

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

import java.io.File;

import java.io.FileOutputStream;
import java.io.IOException;

import java.util.zip.ZipInputStream;

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

    private static final File unzipEntry(ZipInputStream zis, File targetFile)
            throws IOException {
        FileOutputStream fos = new FileOutputStream(targetFile);

        byte[] buffer = new byte[BUFFER_SIZE];
        int len = 0;
        while ((len = zis.read(buffer)) != -1) {
            fos.write(buffer, 0, len);/*w ww .  j  av a  2s  .co m*/
        }

        return targetFile;
    }
}

Related

  1. upzip(ZipInputStream zip, String destPath)
  2. unzipEntry(ZipInputStream zis, File targetFile)