* Zip 파일 생성
* @param os
* @param filenameList
* @param contentList
* @return
* @throws Exception
*/
public static ZipOutputStream makeZip(OutputStream os, List<String> filenameList, List<String> contentList) throws Exception {
ZipOutputStream jos = new ZipOutputStream(os);
long now = System.currentTimeMillis();
for (int i = 0; i < filenameList.size(); i++) {
String filename = filenameList.get(i);
String content = contentList.get(i);
ZipEntry zipAdd = new ZipEntry(filename);
zipAdd.setTime(now);
jos.putNextEntry(zipAdd);
byte[] b = content.getBytes("UTF-8");
jos.write(b, 0, b.length);
}
jos.close();
return jos;
}
댓글 없음:
댓글 쓰기