@Override
	public int read(char cbuf[], int off, int len) throws IOException {
		synchronized (lock) {
			ensureOpen();
			if ((off < 0) || (off > cbuf.length) || (len < 0)
					|| ((off + len) > cbuf.length) || ((off + len) < 0)) {
				throw new IndexOutOfBoundsException();
			} else if (len == 0) {
				return 0;
			}

			int n = read1(cbuf, off, len);
			if (n <= 0)
				return n;
			while ((n < len) && in.ready()) {
				int n1 = read1(cbuf, off + n, len - n);
				if (n1 <= 0)
					break;
				n += n1;
			}
			return n;
		}
	}
Reads characters into a portion of an array.

<p>
This method implements the general contract of the corresponding
<code>{@link Reader#read(char[], int, int) read}</code> method of the
<code>{@link Reader}</code> class. As an additional convenience, it
attempts to read as many characters as possible by repeatedly invoking
the <code>read</code> method of the underlying stream. This iterated
<code>read</code> continues until one of the following conditions becomes
true:
<ul>

<li>The specified number of characters have been read,</li>

<li>The <code>read</code> method of the underlying stream returns
<code>-1</code>, indicating end-of-file, or</li>

<li>The <code>ready</code> method of the underlying stream returns
<code>false</code>, indicating that further input requests would block.</li>

</ul>
If the first <code>read</code> on the underlying stream returns
<code>-1</code> to indicate end-of-file then this method returns
<code>-1</code>. Otherwise this method returns the number of characters
actually read.

<p>
Subclasses of this class are encouraged, but not required, to attempt to
read as many characters as possible in the same fashion.

<p>
Ordinarily this method takes characters from this stream's character
buffer, filling it from the underlying stream as necessary. If, however,
the buffer is empty, the mark is not valid, and the requested length is
at least as large as the buffer, then this method will read characters
directly from the underlying stream into the given array. Thus redundant
<code>BufferedReader</code>s will not copy data unnecessarily.

@param cbuf
           Destination buffer
@param off
           Offset at which to start storing characters
@param len
           Maximum number of characters to read

@return The number of characters read, or -1 if the end of the stream has
        been reached

@exception IOException
               If an I/O error occurs
Ghidra/Features/Base/src/main/java/ghidra/app/util/opinion/BoundedBufferedReader.java