private synchronized Buffer getBufferFor(long pos) throws IOException {
		long bufferPos = getBufferPos(pos);
		if (bufferPos >= currentLength) {
			throw new EOFException();
		}
		Buffer buffer = buffers.get(bufferPos);
		if (buffer == null) {
			buffer = new Buffer(bufferPos, (int) Math.min(currentLength - bufferPos, BUFFER_SIZE));
			int bytesRead = doReadBytes(bufferPos, buffer.bytes);
			if (bytesRead != buffer.len) {
				buffer.len = bytesRead;
				// warn?
			}
			buffers.put(bufferPos, buffer);
		}
		lruBuffers.put(bufferPos, buffer);
		return buffer;
	}
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