public synchronized ChainedBuffer split(int offset) throws IndexOutOfBoundsException, IOException {
		if (readOnly) {
			throw new UnsupportedOperationException("Read-only buffer");
		}
		if (firstBufferId < 0) {
			throw new AssertException("Invalid Buffer");
		}
		if (offset < 0 || offset >= size) {
			throw new IndexOutOfBoundsException();
		}

		// Create new DBBuffer
		int cnt = size - offset;
		ChainedBuffer newDBBuf = new ChainedBuffer(cnt, useXORMask, uninitializedDataSource,
			uninitializedDataSourceOffset + offset, bufferMgr);

		// Copy data from this DBBuffer into new DBBuffer
		int newOffset = 0;
		byte[] data = new byte[dataSpace];
		int bufferDataOffset = offset % dataSpace;
		int dataSize = dataSpace - bufferDataOffset;
		for (int index = offset / dataSpace; index < dataBufferIdTable.length; ++index) {
			if (cnt < dataSize) {
				dataSize = cnt;
			}
			if (dataBufferIdTable[index] >= 0) {

				DataBuffer dataBuf = bufferMgr.getBuffer(dataBufferIdTable[index]);
				try {
					dataBuf.get(bufferDataOffset + dataBaseOffset, data, 0, dataSize);
					if (useXORMask) {
						for (int i = 0; i < dataSize; i++) {
							data[i] = xorMaskByte(bufferDataOffset + i, data[i]);
						}
					}
					newDBBuf.put(newOffset, data, 0, dataSize);
				}
				finally {
					bufferMgr.releaseBuffer(dataBuf);
				}

				// Delete original data buffer if all data was copied
				if (bufferDataOffset == 0) {
					bufferMgr.deleteBuffer(dataBufferIdTable[index]);
					dataBufferIdTable[index] = -1;
				}
			}
			cnt -= dataSize;
			newOffset += dataSize;
			bufferDataOffset = 0;
			dataSize = data.length;
		}

		// Resize this buffer
		shrink(offset, true);

		return newDBBuf;
	}
Split this DBBuffer object into two separate DBBuffers.  This DBBuffer remains
valid but its new size is equal offset.  The newly created DBBuffer is 
returned.
@param offset the split point.  The byte at this offset becomes the first
byte within the new buffer.
@return the new DBBuffer object.
@throws UnsupportedOperationException thrown if this ChainedBuffer is read-only
@throws IndexOutOfBoundsException if offset is invalid.
@throws IOException thrown if an IO error occurs
Ghidra/Framework/DB/src/main/java/db/ChainedBuffer.java