java壓縮文件工具類免費下載
解決方法:
1.使用方法
String id = StringUtil.getid();
String tempPath = System.getProperty("catalina.home") + "/temp/"+ id + "/" ;
String zippath = System.getProperty("catalina.home") + "/temp/" + id + ".zip";//壓縮包,把xls文件壓縮到zip中,在瀏覽器下載
File zipfile = new File(zippath);
FileOutputStream fos1 = new FileOutputStream(zipfile);
ZipUtils.toZip(tempPath, fos1, true);//tempPath目錄中的文件打包到zip中