private int pullFromInputBuffer() throws IOException {
		while (true) {
			this.inputLock.writeLock().lock();
			try {
				this.ensureOpen();
				if (!this.reachedEnd && this.inputBuffer.length() == this.inputBufferPos) {
					this.reachedEnd = true;
					return -1;
				} else if (this.inputBufferPos < this.inputBuffer.length()) {
					this.shouldRead = false;
					this.reachedEnd = false;
					return this.inputBuffer.charAt(this.inputBufferPos++);
				}
			} finally {
				this.inputLock.writeLock().unlock();
			}
			try {
				synchronized (this) {
					this.shouldRead = true;
					this.wait();
				}
			} catch (InterruptedException ex) {
				throw new SimpleException(ex);
			}
		}
	}