@Override public InputStream openStream() throws IOException { return gzipInputStream(in.openStream()); } },
/** * gunzip from the source stream to the destination stream. * * @param in The input stream which is to be decompressed. This stream is closed. * @param out The output stream to write to. This stream is closed * * @return The number of bytes written to the output stream. * * @throws IOException */ public static long gunzip(InputStream in, OutputStream out) throws IOException { try (GZIPInputStream gzipInputStream = gzipInputStream(in)) { final long result = ByteStreams.copy(gzipInputStream, out); out.flush(); return result; } finally { out.close(); } }
/** * Unzips the input stream via a gzip filter. use gunzip(ByteSource, File, Predicate) if possible * * @param in The input stream to run through the gunzip filter. This stream is closed * @param outFile The file to output to * * @throws IOException */ public static FileUtils.FileCopyResult gunzip(InputStream in, File outFile) throws IOException { try (GZIPInputStream gzipInputStream = gzipInputStream(in)) { NativeIO.chunkedCopy(gzipInputStream, outFile); return new FileUtils.FileCopyResult(outFile); } }
return gzipInputStream(in); } else if (fileName.endsWith(BZ2_SUFFIX)) { return new BZip2CompressorInputStream(in, true);
/** * gunzip from the source stream to the destination stream. * * @param in The input stream which is to be decompressed. This stream is closed. * @param out The output stream to write to. This stream is closed * * @return The number of bytes written to the output stream. * * @throws IOException */ public static long gunzip(InputStream in, OutputStream out) throws IOException { try (GZIPInputStream gzipInputStream = gzipInputStream(in)) { final long result = ByteStreams.copy(gzipInputStream, out); out.flush(); return result; } finally { out.close(); } }
@Override public InputStream openStream() throws IOException { return gzipInputStream(in.openStream()); } },
/** * Unzips the input stream via a gzip filter. use gunzip(ByteSource, File, Predicate) if possible * * @param in The input stream to run through the gunzip filter. This stream is closed * @param outFile The file to output to * * @throws IOException */ public static FileUtils.FileCopyResult gunzip(InputStream in, File outFile) throws IOException { try (GZIPInputStream gzipInputStream = gzipInputStream(in)) { NativeIO.chunkedCopy(gzipInputStream, outFile); return new FileUtils.FileCopyResult(outFile); } }
return gzipInputStream(in); } else if (fileName.endsWith(BZ2_SUFFIX)) { return new BZip2CompressorInputStream(in, true);