Java FileOutputStream Write SaveToZipSB(File file, String ZippedFile, StringBuilder sb)

Here you can find the source of SaveToZipSB(File file, String ZippedFile, StringBuilder sb)

Description

Save To Zip SB

License

Open Source License

Declaration

static void SaveToZipSB(File file, String ZippedFile, StringBuilder sb) 

Method Source Code

//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();
        }
    }
}

Related

  1. saveToFile(String data, File file)
  2. saveToFile(String data, File file)
  3. saveToFile(String fileName, String fileCode, File dir, String fileExtention)
  4. saveToFile(String filePath, InputStream in)
  5. saveToTextFile(String filename, byte[] text)
  6. saveZip(String fileName, Map dataMap)
  7. saveZipFile(String zipFileName, File toBeZipped)