tar进一步压缩为.bz2包
/** * 数据压缩 * * @param is * @param os * @throws Exception */ public static void compress(InputStream is, OutputStream os) throws Exception { BZip2CompressorOutputStream gos = new BZip2CompressorOutputStream(os); int count; byte data[] = new byte[BUFFER]; while ((count = is.read(data, 0, BUFFER)) != -1) { gos.write(data, 0, count); } gos.finish(); gos.flush(); gos.close(); }
原文地址:https://blog.csdn.net/navagate/article/details/45956523