private void assertValidIndex(long index, boolean inclusiveMax) throws IOException {
		if (index < 0 || index > srcBytes.length ||
			(inclusiveMax == false && index == srcBytes.length)) {
			throw new IOException(
				"Invalid position, index: " + index + ", max is: " + srcBytes.length);
		}
	}
Throws {@link IOException} if index is not a valid position in the buffer

@param index position in buffer to test
@param inclusiveMax allow buffer.length as index
@throws IOException if index is out of bounds
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/ByteArrayProvider.java