@Override
	public byte[] readAllBytes() throws IOException {
		byte[] result = new byte[available()];
		buffer.get(offset, result);
		offset += result.length;
		return result;
	}
An input stream backed by a database chained buffer
Ghidra/Debug/ProposedUtils/src/main/java/ghidra/util/database/DBBufferInputStream.java