java解压zip文件到指定位置
来源:互联网 发布:小米5网络制式 编辑:程序博客网 时间:2024/04/27 10:49
public void upZip(String merchantZipPath, String merchantUnZipPath,String fileDate) { String filePath = merchantZipPath+File.separator+"merchant_good_"+fileDate+".zip"; File file = new File(filePath); ZipFile zipFile = null; try { zipFile = new ZipFile(file,Charset.forName("GBK"));//设置编码格式 Enumeration e = zipFile.entries(); while(e.hasMoreElements()){ ZipEntry zipEntry = (ZipEntry) e.nextElement(); String name = zipEntry.getName(); if(zipEntry.isDirectory()){ name = name.substring(0,name.length()-1); File file2 = new File(merchantUnZipPath+File.separator+name); file2.mkdirs(); }else { File file2 = new File(merchantUnZipPath+File.separator+"merchant_good_"+fileDate+File.separator+name); file2.getParentFile().mkdirs(); file2.createNewFile(); InputStream in = zipFile.getInputStream(zipEntry); FileOutputStream out = new FileOutputStream(file2); int length = 0; byte[] readByte =new byte[1024]; try { while((length=in.read(readByte,0,1024))!=-1){ out.write(readByte, 0, length); } } catch (Exception e2) { logger.error("解压文件失败!",e2); }finally { CommUtil.releaseIO(in, out); } } } } catch (IOException e) { logger.error("解压文件不存在!",e); }
阅读全文
0 0
- java解压zip文件到指定位置
- zip包解压到指定的位置
- Java实现zip文件解压[到指定目录]
- Java实现zip文件解压[到指定目录]
- 解压.zip文件到指定的目录
- PHP 解压 ZIP 文件到指定文件夹
- android中 解压对应的zip文件 到指定文件
- AIR操作zip解压文件到指定目录下
- JAVA远程下载zip包并解压到指定目录
- Java解压zip文件
- zip解压文件java
- java-zip解压文件
- JAVA解压ZIP文件
- Java解压zip文件
- java-解压zip文件
- java--解压zip文件
- java 解压zip文件
- JAVA解压ZIP文件
- 配置文件读写操作(.ini)
- js 获取excel文件并以json形式输出
- js获取浏览器窗口的大小
- App Store 审核条款最新版--iOS审核被拒的原因都在这里了--苹果应用商店审核条款
- 快速学习Markdown
- java解压zip文件到指定位置
- 读书笔记——JAVA核心技术-卷II
- hibernate笔记12 HQL多表查询
- <安彦>Linux系统时间同步
- 数字加密解密类-php
- java虚拟机参数
- yum的卸载与重新安装
- 用JS获取网页地址栏参数的简便方法
- 流媒体 关键词解释