public void process(char[] input, int contentLength) {
    int offset = 0;
    while (offset < contentLength) {
      int nextLine = indexOfNewline(input, offset, contentLength);
      if (nextLine == -1) {
        if (myBufferedCr) sendBufferLine();
        myLineBuffer.append(input, offset, contentLength - offset);
        break;
      }

      boolean isCr = input[nextLine] == '\r';
      if (isCr && nextLine + 1 == contentLength) { // CR at buffer end
        if (myBufferedCr) sendBufferLine();
        myLineBuffer.append(input, offset, nextLine - offset);
        myBufferedCr = true;
        break;
      }

      if (myBufferedCr) {
        if (input[offset] == '\n') {
          myBufferedCr = false; // CRLF on buffer edge
        }
        else {
          sendBufferLine();
        }
      }

      boolean isCrLf = isCr && input[nextLine + 1] == '\n';
      boolean isCrLine = isCr && !isCrLf;

      if (myLineBuffer.length() == 0) {
        String text = new String(input, offset, nextLine - offset);
        myLineConsumer.consume(text, isCrLine);
      }
      else {
        myBufferedCr = isCrLine;
        myLineBuffer.append(input, offset, nextLine - offset);
        sendBufferLine();
      }

      offset = isCrLf ? nextLine + 2 : nextLine + 1;
    }
  }
public void process(char[] input, int contentLength)