code: protected void readComment(DTDEventListener l)
          throws XMLStreamException
      {
          TextBuffer tb = getTextBuffer();
          char[] outBuf = tb.getCurrentSegment();
          int outPtr = 0;
  
          while (true) {
              char c = (mInputPtr < mInputEnd)
                  ? mInputBuffer[mInputPtr++] : dtdNextFromCurr();
              if (c < CHAR_SPACE) {
                  if (c == '\n' || c == '\r') {
                      skipCRLF(c);
                      c = '\n';
                  } else if (c != '\t') {
                      throwInvalidSpace(c);
                  }
              } else if (c == '-') {
                  c = dtdNextFromCurr();
                  if (c == '-') { // Ok, has to be end marker then:
                      // Either get '>' or error:
                      c = dtdNextFromCurr();
                      if (c != '>') {
                          throwParseError(ErrorConsts.ERR_HYPHENS_IN_COMMENT);
                      }
                      break;
                  }
                  c = '-';
                  --mInputPtr; // need to push back the second char read
              }
              // Need more room?
              if (outPtr >= outBuf.length) {
                  outBuf = tb.finishCurrentSegment();
                  outPtr = 0;
              }
              // Ok, let's add char to output:
              outBuf[outPtr++] = c;
          }
          tb.setCurrentLength(outPtr);
          tb.fireDtdCommentEvent(l);
      }
docs: Method similar to {@link #skipComment}, but that has to collect
  contents, to be reported for a SAX handler.