question: public static boolean isGZip ( BufferedInputStream instream ) { instream . mark ( 2 ) ; byte [ ] b = new byte [ 2 ] ; try { instream . read ( b , 0 , 2 ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Couldn't read header from stream " , ex ) ; } try { instream . reset ( ) ; } catch ( Exception ex ) { throw new RuntimeException ( "Couldn't reset stream " , ex ) ; } return ( b [ 0 ] == 31 && b [ 1 ] == - 117 ) ; }
target:  Test for GZIP stream signature.