private void buildIndex(DataBuffer indexBuffer) throws IOException {

		int indexCount = allocateIndex(indexBuffer);
		int indexBufferCount = ((indexCount - 1) / indexesPerBuffer) + 1;
		indexBufferIdTable = new int[indexBufferCount];

		try {
			int index = 0;
			indexBufferIdTable[index] = indexBuffer.getId();
			int ix = 0;
			int offset = INDEX_BASE_OFFSET;
			for (int i = 0; i < indexCount; i++) {

				// Advance to next index buffer if needed
				if (ix == indexesPerBuffer) {
					int nextId = indexBuffer.getInt(NEXT_INDEX_ID_OFFSET);
					if (nextId < 0) {
						throw new AssertException();
					}
					bufferMgr.releaseBuffer(indexBuffer);
					indexBuffer = bufferMgr.getBuffer(nextId);
					indexBufferIdTable[++index] = indexBuffer.getId();
					ix = 0;
					offset = INDEX_BASE_OFFSET;
				}

				// Fetch next index buffer ID
				dataBufferIdTable[i] = indexBuffer.getInt(offset);
				offset += ID_SIZE;
				++ix;
			}
		}
		finally {
			bufferMgr.releaseBuffer(indexBuffer);
		}
	}
Build the in-memory index for a previously stored DBBuffer.
@param indexBuffer first index buffer.  This buffer will be released
prior to returning.
@throws IOException thrown if IO error occurs
Ghidra/Framework/DB/src/main/java/db/ChainedBuffer.java