首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

java创办zip文件

2012-06-27 
java创建zip文件public String createZip(String zipFileName,ListString fileList,String speSymbols){

java创建zip文件

public String createZip(String zipFileName,List<String> fileList,String speSymbols){ZipOutputStream out = null;File zipFile = new File(zipFileName);try {if(!zipFile.exists()){zipFile.createNewFile();}else{zipFile.delete();zipFile.createNewFile();}out = new ZipOutputStream(new FileOutputStream(zipFile));for(String filePath: fileList){File file = new File(filePath);ZipEntry ent = new ZipEntry(file.getName());FileInputStream ins = new FileInputStream (file);out.putNextEntry(ent);int b = 0;while((b=ins.read())!=-1){out.write(b);}ins.close();}out.close();} catch (Exception e) {// TODO: handle exceptione.printStackTrace();}return null;}

热点排行