为了正常的体验网站,请在浏览器设置里面开启Javascript功能!

zip压缩下载

2017-08-31 4页 doc 15KB 141阅读

用户头像

is_769254

暂无简介

举报
zip压缩下载zip压缩下载 Action /** * 压压压下 * @author 李蒙 * @return * @throws Exception */ public String bathdownloadAttachment() throws Exception { //压压压压压压压压压压压下名字中文乱 strZipName=new String("压压压压压意度自述告.zip".getBytes("GBK"), "ISO-8859-1"); inputStream=batchDownloadAttchService.bathd...
zip压缩下载
zip压缩下载 Action /** * 压压压下 * @author 李蒙 * @return * @throws Exception */ public String bathdownloadAttachment() throws Exception { //压压压压压压压压压压压下名字中文乱 strZipName=new String("压压压压压意度自述告.zip".getBytes("GBK"), "ISO-8859-1"); inputStream=batchDownloadAttchService.bathdownloadAttachment(selfReportsIds); return "bathdownloadAttachment"; } Service /** * @功能:附件压压压压 * @author 李蒙 * @return * @throws Exception */ public InputStream bathdownloadAttachment(List selfReportsIds) throws Exception { byte[] buffer = new byte[8094]; //压压压压压压压压压压压压压压置写入服器名字加上戳区分附件 String writeName = System.currentTimeMillis()+".zip"; //压压附件 List f=this.findTpmsReSelfReports(selfReportsIds); //服起路径压压压压 String saveRootPath=ServletActionContext.getRequest().getSession().getServletContext().getRealPath(File.separator); //生成附件的路径 String fileRelativePath = saveRootPath+File.separator+"reportsUploads"+File.separator+writeName; //在fileRelativePath生成文件 File file = new File(fileRelativePath); if(f.size()!=0&&f!=null){ //写入文件 ZipOutputStream outInputStream = new ZipOutputStream(new FileOutputStream(fileRelativePath)); for (int i = 0; i < f.size(); i++) { fileInputStream = new FileInputStream(f.get(i)); outInputStream.putNextEntry(new ZipEntry(f.get(i).getName())); int len; // 压压压压压压压压压压压压入需要下的文件的,打包到zip 文件 while ((len = fileInputStream.read(buffer)) > 0) { outInputStream.write(buffer, 0, len); } outInputStream.closeEntry(); fileInputStream.close(); } inputStream = new FileInputStream(file); outInputStream.close(); return inputStream; } return null; } Struts application/octet-stream;charset=ISO8859-1 inputStream attachment;filename="${strZipName}" 8094
/
本文档为【zip压缩下载】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。 本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。 网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。

历史搜索

    清空历史搜索