private boolean fetchBytesFromQueue(boolean blocking) {

			try {
				// if the current byte buffer is exhausted, loop until we get
				// a new non-empty byte buffer.
				while (!isClosed.get() && position >= bytes.length) {
					byte[] newBytes = blocking ? queuedBytes.take() : queuedBytes.poll();
					if (newBytes == null) {
						// this only happens when blocking == false, ie. a poll() operation
						break;
					}
					bytes = newBytes;
					position = 0;
				}
			}
			catch (InterruptedException e) {
				// fall thru to return which will return false
			}

			return position < bytes.length;
		}
An {@link InputStream} that has as its source text strings being pushed into
it by a thread, and being read by another thread.
<p>
Not thread-safe for multiple readers, but is thread-safe for writers.
<p>
{@link #close() Closing} this stream (from any thread) will awaken the
blocked reader thread and give an EOF result to the read operation it was blocking on.
Ghidra/Features/Base/src/main/java/ghidra/app/plugin/core/interpreter/InterpreterPanel.java