private void ensureBounds(long index, long length) throws IOException {
		if (index < 0 || index > currentLength) {
			throw new IOException("Invalid index: " + index);
		}
		if (index + length > currentLength) {
			throw new IOException("Unable to read past EOF: " + index + ", " + length);
		}
	}
Writes the specified bytes to the file.
<p>
Protected by synchronized lock (See {@link #writeBytes(long, byte[], int, int)})

@param index file position of where to write
@param buffer byte array containing bytes to write
@param offset offset inside of byte array to start
@param length number of bytes from buffer to write
@throws IOException if error
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/FileByteProvider.java