`
tomp110
  • 浏览: 30637 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

zip解压

    博客分类:
  • Java
阅读更多
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[1024];  
   
  int   len;  
  while   ((len   =   in.read(buf))   >   0)   {  
  os.write(buf,   0,   len);  
  }  
  os.close();  
  in.closeEntry();  
   
  }  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics