public int read(byte[] b, int offset, int length) throws IOException {
		checkOpen();
		int readLen = length;
		do {
			int blocklength = readLen;
			if (readLen > (BUFFER_SIZE - bufferOffset)) {
				blocklength = (BUFFER_SIZE - (int) bufferOffset);
				if (blocklength <= 0) {
					blocklength = BUFFER_SIZE;
				}
			}
			ensure(blocklength);
			System.arraycopy(buffer, (int) bufferOffset, b, offset, blocklength);
			readLen -= blocklength;
			offset += blocklength;
			if (readLen > 0) {
				seek(this.bufferFileStartIndex + bufferOffset + blocklength);
			}
		}
		while (readLen > 0);
		return length;
	}
Reads up to <code>length</code> bytes of data from this file into an
array of bytes. This method blocks until at least one byte of input
is available.

@param      b the buffer into which the data is read.
@param      offset the start offset of the data.
@param      length the maximum number of bytes read.
@return     the total number of bytes read into the buffer, or
            <code>-1</code> if there is no more data because the end of
            the file has been reached.
@exception  IOException  if an I/O error occurs.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/GhidraRandomAccessFile.java