diff --git a/src/main/java/com/metamx/common/CompressionUtils.java b/src/main/java/com/metamx/common/CompressionUtils.java index 70915dd1..8f3857e9 100644 --- a/src/main/java/com/metamx/common/CompressionUtils.java +++ b/src/main/java/com/metamx/common/CompressionUtils.java @@ -297,10 +297,12 @@ public static GZIPInputStream gzipInputStream(final InputStream in) throws IOExc new FilterInputStream(in) { @Override - public int available() + public int available() throws IOException { - // Hack. Docs say available() should return an estimate, so we estimate about 1KB to work around available == 0 bug in GZIPInputStream - return 1 << 10; + final int otherAvailable = super.available(); + // Hack. Docs say available() should return an estimate, + // so we estimate about 1KB to work around available == 0 bug in GZIPInputStream + return otherAvailable == 0 ? 1 << 10 : otherAvailable; } } );