将文件压缩为gz

时间:2013-04-03 12:28:55

标签: java compression gz

还有其他方法可以更好地压缩到gz吗?

FileOutputStream outFile = new FileOutputStream(outFileName);
GZIPOutputStream out = new GZIPOutputStream(outFile);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) 
{
    out.write(buf, 0, len);
}
in.close();
out.close();
outFile.close();

0 个答案:

没有答案