public static void Decompress(String file,String parent) {
// TODO Auto-generated method stub
try {
ZipInputStream Zin=new ZipInputStream(new FileInputStream(file));
BufferedInputStream Bin=new BufferedInputStream(Zin);
File Fout=null;
ZipEntry entry;
try {
while((entry = Zin.getNextEntry())!=null && !entry.isDirectory()){
Fout=new File(parent,entry.getName());
if(!Fout.exists()){
(new File(Fout.getParent())).mkdirs();
}
FileOutputStream out=new FileOutputStream(Fout);
BufferedOutputStream Bout=new BufferedOutputStream(out);
int b;
while((b=Bin.read())!=-1){
Bout.write(b);
}
Bout.close();
out.close();
RationalTestScript.logInfo(Fout+"解压成功");
}
Bin.close();
Zin.close();
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
解压缩zip文件
最新推荐文章于 2019-04-20 10:53:55 发布