public static FSAHeader read ( InputStream in ) throws IOException { if ( in . read ( ) != ( ( FSA_MAGIC >>> 24 ) ) || in . read ( ) != ( ( FSA_MAGIC >>> 16 ) & 0xff ) || in . read ( ) != ( ( FSA_MAGIC >>> 8 ) & 0xff ) || in . read ( ) != ( ( FSA_MAGIC ) & 0xff ) ) { throw new IOException ( "Invalid file header, probably not an FSA." ) ; } int version = in . read ( ) ; if ( version == - 1 ) { throw new IOException ( "Truncated file, no version number." ) ; } return new FSAHeader ( ( byte ) version ) ; }
Read FSA header and version from a stream consuming read bytes .