private static byte [ ] gzip ( final InputStream input ) throws IOException { final ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ; // @checkstyle MagicNumberCheck (1 line) final byte [ ] buf = new byte [ 4096 ] ; final OutputStream gzip = new GZIPOutputStream ( baos ) ; try { while ( true ) { final int len = input . read ( buf ) ; if ( len < 0 ) { break ; } gzip . write ( buf , 0 , len ) ; } } finally { gzip . close ( ) ; input . close ( ) ; } return baos . toByteArray ( ) ; }
Gzip input stream .