日期:2014-05-20 浏览次数:21038 次
public static void unzip(String zipFile, String destpath)
throws IOException {
ZipInputStream zis = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry z = null;
while ((z = zis.getNextEntry()) != null) {
if (z.isDirectory()) {
File f = new File(destpath + z.getName());
f.mkdirs();
} else {
String file = z.getName();
FileOutputStream fos = new FileOutputStream(destpath + file);
int tmp = -1;
[color=#FF0000]while ((tmp = zis.read()) != -1) {[/color]
fos.write(tmp);
}
zis.closeEntry();
fos.close();
}
}
}