@Override
	public void setPosition(Address addr) {
		if (minOffset <= maxOffset) {
			if (addr.getAddressSpace().equals(startAddr.getAddressSpace())) {
				long diff = addr.subtract(startAddr);
				if (diff >= minOffset && diff < maxOffset - threshold) {
					startAddr = addr;
					minOffset -= (int) diff;
					maxOffset -= (int) diff;
					startAddrIndex += diff;
					return;
				}
			}
		}
		startAddr = addr;
		startAddrIndex = 0;
		minOffset = 0;
		maxOffset = -1;

		try {
			maxOffset = mem.getBytes(addr, buffer, 0, buffer.length) - 1;
		}
		catch (AddressOutOfBoundsException | MemoryAccessException e) {
			// handled by maxOffset == -1
		}
	}
Construct a new MemoryBufferImpl
@param mem memory associated with the given address
@param addr start address
@param bufSize the size of the memory buffer.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/mem/MemoryBufferImpl.java