List of usage examples for org.apache.commons.compress.compressors.bzip2 BZip2CompressorInputStream getBytesRead
public long getBytesRead()
From source file:net.orpiske.ssps.common.archive.CompressedArchiveUtils.java
/** * Decompress a file//from w ww . j av a 2 s.c om * @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 bzipDecompress(File source, File destination) throws IOException { FileOutputStream out; prepareDestination(destination); out = new FileOutputStream(destination); FileInputStream fin = null; BufferedInputStream bin = null; BZip2CompressorInputStream bzIn = null; try { fin = new FileInputStream(source); bin = new BufferedInputStream(fin); bzIn = new BZip2CompressorInputStream(bin); IOUtils.copy(bzIn, out); bzIn.close(); fin.close(); bin.close(); out.close(); } catch (IOException e) { IOUtils.closeQuietly(out); IOUtils.closeQuietly(fin); IOUtils.closeQuietly(bin); IOUtils.closeQuietly(bzIn); throw e; } return bzIn.getBytesRead(); }