欢迎访问悦橙教程(wld5.com),关注java教程。悦橙教程  java问答|  每日更新
页面导航 : > > 文章正文

java 从在内存中创建ZIP文件,java内存创建zip,private stat

来源: javaer 分享于  点击 22614 次 点评:143

java 从在内存中创建ZIP文件,java内存创建zip,private stat


private static byte[] createZip(Map files) throws IOException {       ByteArrayOutputStream bos = new ByteArrayOutputStream();       ZipOutputStream zipfile = new ZipOutputStream(bos);       Iterator i = files.keySet().iterator();       String fileName = null;       ZipEntry zipentry = null;       while (i.hasNext()) {           fileName = (String) i.next();           zipentry = new ZipEntry(fileName);           zipfile.putNextEntry(zipentry);           zipfile.write((byte[]) files.get(fileName));       }       zipfile.close();       return bos.toByteArray();   }
相关栏目:

用户点评