/** * Read the tables for the current database file. * @throws IOException if the file could not be read * @throws MetakitException if the file is not valid for the Metakit format */ private void initialize() throws IOException, MetakitException { String magic = stream.readString(2); if (magic.equals("JL")) { littleEndian = true; } else if (!magic.equals("LJ")) { throw new MetakitException("Invalid magic string; got " + magic); } boolean valid = stream.read() == 26; if (!valid) { throw new MetakitException("'valid' flag was set to 'false'"); } int headerType = stream.read(); if (headerType != 0) { throw new MetakitException( "Header type " + headerType + " is not valid."); } long footerPointer = stream.readInt() - 16; stream.seek(footerPointer); readFooter(); }