code: public int read(char[] buf, int off, int len) throws IOException {
          // do not claim if len == 0
          if (len == 0) {
              return 0;
          }
  
          // init lookahead, but do not block !!
          if (lookaheadChar == UNDEFINED) {
              if (ready()) {
                  lookaheadChar = super.read();
              } else {
                  return -1;
              }
          }
          // 'first read of underlying stream'
          if (lookaheadChar == -1) {
              return -1;
          }
          // continue until the lookaheadChar would block
          int cOff = off;
          while (len > 0 && ready()) {
              if (lookaheadChar == -1) {
                  // eof stream reached, do not continue
                  return cOff - off;
              } else {
                  buf[cOff++] = (char) lookaheadChar;
                  if (lookaheadChar == '\n') {
                      lineCounter++;
                  }
                  lastChar = lookaheadChar;
                  lookaheadChar = super.read();
                  len--;
              }
          }
          return cOff - off;
      }
docs: Non-blocking reading of len chars into buffer buf starting
  at bufferposition off.
  
  performs an iteratative read on the underlying stream
  as long as the following conditions hold:
  - less than len chars have been read
  - end of stream has not been reached
  - next read is not blocking
  
  @return nof chars actually read or END_OF_STREAM