List of usage examples for org.apache.commons.compress.compressors.gzip GzipCompressorOutputStream write
public void write(byte[] b, int from, int length) throws IOException
From source file:msec.org.GzipUtil.java
static public void zip(String srcFile, String destFile) throws Exception { GzipCompressorOutputStream out = new GzipCompressorOutputStream(new FileOutputStream(destFile)); FileInputStream in = new FileInputStream(srcFile); byte[] buf = new byte[10240]; while (true) { int len = in.read(buf); if (len <= 0) { break; }/*from w w w. ja va 2 s . c o m*/ out.write(buf, 0, len); } out.flush(); out.close(); in.close(); }
From source file:msec.org.GzipUtil.java
static public void zip(String srcFile) throws Exception { GzipCompressorOutputStream out = new GzipCompressorOutputStream(new FileOutputStream(srcFile + ".gz")); FileInputStream in = new FileInputStream(srcFile); byte[] buf = new byte[10240]; while (true) { int len = in.read(buf); if (len <= 0) { break; }/*from w ww . j av a2s . c om*/ out.write(buf, 0, len); } out.flush(); out.close(); in.close(); }