Java 解压带文件夹的zip 文件

public static boolean unzip(String zip, String outputPath) {
boolean isUnzipOk = true;
try {
ZipInputStream Zin = new ZipInputStream(new FileInputStream(zip));//输入源zip路径
BufferedInputStream Bin = new BufferedInputStream(Zin);
File outputFile;
ZipEntry entry;
while ((entry = Zin.getNextEntry()) != null) {
outputFile = new File(outputPath, entry.getName());
if (entry.isDirectory()) {
continue;
} else {
File parent = new File(outputFile.getParent());
if (!outputFile.exists())
if (!parent.mkdirs())
return false;
}


FileOutputStream out = new FileOutputStream(outputFile);
BufferedOutputStream Bout = new BufferedOutputStream(out);
int b;
while ((b = Bin.read()) != -1) {
Bout.write(b);
}
Bout.close();
out.close();
}
Bin.close();
Zin.close();
} catch (Exception e) {
e.printStackTrace();
isUnzipOk = false;
}

return isUnzipOk;
}