private void initializeAllocatedBuffer(int chainBufferIndex, DataBuffer buf)
			throws IndexOutOfBoundsException, IOException {

		int offset = chainBufferIndex * dataSpace;
		int len = size - offset;
		if (len >= dataSpace) {
			len = dataSpace;
		}
		else {
			buf.clear(); // partial fill - clear entire buffer first
		}

		byte[] data = new byte[len];
		if (uninitializedDataSource != null) {
			uninitializedDataSource.get(uninitializedDataSourceOffset + offset, data, 0, len);
		}
		if (useXORMask) {
			for (int i = 0; i < len; i++) {
				data[i] = xorMaskByte(i, data[i]);
			}
		}
		buf.put(dataBaseOffset, data);
	}
Initialize specified DataBuffer which corresponds to the chain index.
@param chainBufferIndex chain buffer index
@param buf newly allocated database buffer
@throws IOException thrown if an IO error occurs
Ghidra/Framework/DB/src/main/java/db/ChainedBuffer.java