Here you can find the source of SaveToZipSB(File file, String ZippedFile, StringBuilder sb)
static void SaveToZipSB(File file, String ZippedFile, StringBuilder sb)
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileOutputStream; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class Main { static void SaveToZipSB(File file, String ZippedFile, StringBuilder sb) { try {//from ww w. ja va 2s. c om final ZipOutputStream out = new ZipOutputStream( new FileOutputStream(file)); ZipEntry e = new ZipEntry(ZippedFile); out.putNextEntry(e); byte[] data = sb.toString().getBytes(); out.write(data, 0, data.length); out.closeEntry(); out.close(); } catch (Exception e) { e.printStackTrace(); } } }