code: 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);
    }
docs: Read FSA header and version from a stream, consuming read bytes.
  
  @param in The input stream to read data from.
  @return Returns a valid {@link FSAHeader} with version information.
  @throws IOException If the stream ends prematurely or if it contains invalid data.