List of usage examples for org.apache.commons.compress.compressors.gzip GzipCompressorOutputStream flush
public void flush() 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 .j av a 2 s. c om 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 a va 2 s. c o m*/ out.write(buf, 0, len); } out.flush(); out.close(); in.close(); }