tomp110 发表于 2013-2-7 09:33:04

zip解压

private   static   void   extZipFileList(String   zipFileName,   String   extPlace)   {   
try   {   
   
ZipInputStream   in   =   new   ZipInputStream(new   FileInputStream(   
zipFileName));   
   
ZipEntry   entry   =   null;   
   
while   ((entry   =   in.getNextEntry())   !=   null)   {   
   
String   entryName   =   entry.getName();   
   
if   (entry.isDirectory())   {   
File   file   =   new   File(extPlace   +   entryName);   
file.mkdirs();   
System.out.println("创建文件夹:"   +   entryName);   
}   else   {   
   
FileOutputStream   os   =   new   FileOutputStream(extPlace   
+   entryName);   
   
//   Transfer   bytes   from   the   ZIP   file   to   the   output   file   
byte[]   buf   =   new   byte;   
   
int   len;   
while   ((len   =   in.read(buf))   >   0)   {   
os.write(buf,   0,   len);   
}   
os.close();   
in.closeEntry();   
   
}
页: [1]
查看完整版本: zip解压