private void readBufferMap(int mapIndex) throws IOException {

		bufferIndexMap = new IntIntHashtable();
		
		int maxOffset = bufferSize - BUFFER_MAP_ENTRY_SIZE;
		
		lastMapIndex = mapIndex;
		lastMapBuffer = new DataBuffer();
		versionFile.get(lastMapBuffer, mapIndex);
		if (lastMapBuffer.isEmpty()) {
			throw new IOException(BAD_BUFFER_MAP);	
		}
		nextMapEntryOffset = FIRST_ENTRY_OFFSET;
		
		while (true) {
			if (nextMapEntryOffset > maxOffset) {
				// Get next map buffer
				mapIndex = lastMapBuffer.getInt(NEXT_BUFFER_INDEX_OFFSET);
				versionFile.get(lastMapBuffer, mapIndex);
				lastMapIndex = mapIndex;
				if (lastMapBuffer.isEmpty()) {
					throw new IOException(BAD_BUFFER_MAP);	
				}
				nextMapEntryOffset = FIRST_ENTRY_OFFSET;
			}
	
			// Read map entry - end of list signified by -1
			int origIndex = lastMapBuffer.getInt(nextMapEntryOffset);
			if (origIndex < 0) {
				return;
			}
			nextMapEntryOffset += 4;
			int verIndex = lastMapBuffer.getInt(nextMapEntryOffset);
			nextMapEntryOffset += 4;
			bufferIndexMap.put(origIndex, verIndex);
		}
	}
Reopen version file as read-only
@throws IOException
Ghidra/Framework/DB/src/main/java/db/buffers/VersionFile.java