protected AbstractBAMFileIndex(final File file, final SAMSequenceDictionary dictionary, final boolean useMemoryMapping) { mBamDictionary = dictionary; mIndexBuffer = (useMemoryMapping ? new MemoryMappedFileBuffer(file) : new RandomAccessFileBuffer(file)); // Verify the magic number. seek(0); final byte[] buffer = new byte[4]; readBytes(buffer); if (!Arrays.equals(buffer, BAMFileConstants.BAM_INDEX_MAGIC)) { throw new RuntimeException("Invalid file header in BAM index " + file + ": " + new String(buffer)); } sequenceIndexes = new int[readInteger() + 1]; Arrays.fill(sequenceIndexes, -1); }
protected AbstractBAMFileIndex(final File file, final SAMSequenceDictionary dictionary, final boolean useMemoryMapping) { mBamDictionary = dictionary; mIndexBuffer = (useMemoryMapping ? new MemoryMappedFileBuffer(file) : new RandomAccessFileBuffer(file)); verifyBAMMagicNumber(file.getName()); sequenceIndexes = new int[readInteger() + 1]; Arrays.fill(sequenceIndexes, -1); }