code: public int decode(char[] chars, int pos, int len, MutableBoolean interrupt, int min) throws IOException, CancelException {
  		if (min > len) min = len;
  		int nb = 0;
  		do {
  			if (currentBuffer == null) {
  				if (nextBuffer.isUnblocked())
  					currentBuffer = nextBuffer.blockResult(0);
  				else
  					return nb > 0 ? nb : -2;
  				if (currentBuffer != null)
  					nextBuffer = io.readNextBufferAsync();
  			}
  			int decoded = decode(currentBuffer, chars, pos + nb, len - nb, interrupt, min - nb);
  			if (decoded < 0 || (decoded == 0 && currentBuffer == null))
  				return nb > 0 ? nb : -1;
  			nb += decoded;
  			if (currentBuffer != null && !currentBuffer.hasRemaining())
  				currentBuffer = null;
  			if (nb == len)
  				return nb;
  			if (nb >= min && interrupt.get())
  				return nb;
  		} while (true);
  	}
docs: Decode characters from the IO.
  @param chars array to fill
  @param pos offset in the array to fill
  @param len maximum number of characters to fill
  @param interrupt when true, the decoding will stop as soon as possible
  @param min minimum number of characters to fill, regardless of the interrupt value
  @return number of decoded characters, -1 if no more characters can be decoded, -2 if we need to wait for next buffer from the IO
  @throws IOException error reading from IO
  @throws CancelException IO has been cancelled