private int getMagicNumber ( InputStream in ) throws IOException { int t = in . read ( ) ; if ( t < 0 ) throw new EOFException ( "Failed to read magic number" ) ; int magic = ( t & 0xff ) << 8 ; t = in . read ( ) ; if ( t < 0 ) throw new EOFException ( "Failed to read magic number" ) ; magic += t & 0xff ; return magic ; }
open the file and read the magic number from the beginning this is used to determine the compression type