List of usage examples for org.apache.commons.compress.compressors.gzip GzipCompressorInputStream getBytesRead
public long getBytesRead()
From source file:net.orpiske.ssps.common.archive.CompressedArchiveUtils.java
/** * Decompress a file//from ww w .j a v a2s. c o m * @param source the source file to be uncompressed * @param destination the destination directory * @return the number of bytes read * @throws IOException for lower level I/O errors */ public static long gzDecompress(File source, File destination) throws IOException { FileOutputStream out; prepareDestination(destination); out = new FileOutputStream(destination); FileInputStream fin = null; BufferedInputStream bin = null; GzipCompressorInputStream gzIn = null; try { fin = new FileInputStream(source); bin = new BufferedInputStream(fin); gzIn = new GzipCompressorInputStream(bin); IOUtils.copy(gzIn, out); gzIn.close(); fin.close(); bin.close(); out.close(); } catch (IOException e) { IOUtils.closeQuietly(out); IOUtils.closeQuietly(fin); IOUtils.closeQuietly(bin); IOUtils.closeQuietly(gzIn); throw e; } return gzIn.getBytesRead(); }