code: protected void add(char[] cbuf, int off, int len) throws IOException {
      int pos = off;
      if (sawReturn && len > 0) {
        // Last call to add ended with a CR; we can handle the line now.
        if (finishLine(cbuf[pos] == '\n')) {
          pos++;
        }
      }
  
      int start = pos;
      for (int end = off + len; pos < end; pos++) {
        switch (cbuf[pos]) {
          case '\r':
            line.append(cbuf, start, pos - start);
            sawReturn = true;
            if (pos + 1 < end) {
              if (finishLine(cbuf[pos + 1] == '\n')) {
                pos++;
              }
            }
            start = pos + 1;
            break;
  
          case '\n':
            line.append(cbuf, start, pos - start);
            finishLine(true);
            start = pos + 1;
            break;
  
          default:
            // do nothing
        }
      }
      line.append(cbuf, start, off + len - start);
    }
docs: Process additional characters from the stream. When a line separator is found the contents of
  the line and the line separator itself are passed to the abstract {@link #handleLine} method.
  
  @param cbuf the character buffer to process
  @param off the offset into the buffer
  @param len the number of characters to process
  @throws IOException if an I/O error occurs
  @see #finish