压缩到文件
/*来自 时 代 J a v a 公 众 号*/ //package com.nowjava; import java.io.*; import java.util.zip.GZIPOutputStream; public class Main { public static void compressToFile(File dest, String str) throws IOException { if (str == null) { return; } GZIPOutputStream zipOut = null; try {//nowjava.com - 时代Java 提供 zipOut = new GZIPOutputStream(new FileOutputStream(dest)); zipOut.write(str.getBytes()); } finally { if (zipOut != null) { try {