Here you can find the source of unzipEntry(ZipInputStream zis, File targetFile)
Parameter | Description |
---|---|
zis | a parameter |
targetFile | a parameter |
Parameter | Description |
---|---|
IOException | an exception |
private static final File unzipEntry(ZipInputStream zis, File targetFile) throws IOException
//package com.java2s; 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; /**/* w ww . j a va 2s . c o m*/ * Unzip one entry * * @param zis * @param targetFile * @return * @throws IOException */ 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); } return targetFile; } }