code: void parseDocument(
              final char[] buffer, final int offset, final int len,
              final IMarkupHandler handler, final ParseStatus status)
              throws ParseException {
  
  
          final long parsingStartTimeNanos = System.nanoTime();
  
          try {
  
              handler.handleDocumentStart(parsingStartTimeNanos, 1, 1);
  
              status.offset = -1;
              status.line = 1;
              status.col = 1;
              status.inStructure = false;
              status.parsingDisabled = true;
              status.parsingDisabledLimitSequence = null;
              status.autoCloseRequired = null;
              status.autoCloseLimits = null;
  
              parseBuffer(buffer, offset, len, handler, status);
  
              // First parse done, now it's time to clean up in case we still have some text to be notified
  
              int lastLine = status.line;
              int lastCol = status.col;
  
              final int lastStart = status.offset;
              final int lastLen = (offset + len) - lastStart;
  
              if (lastLen > 0) {
  
                  if (status.inStructure) {
                      throw new ParseException(
                              "Incomplete structure: \"" + new String(buffer, lastStart, lastLen) + "\"", status.line, status.col);
                  }
  
                  handler.handleText(buffer, lastStart, lastLen, status.line, status.col);
  
                  // As we have produced an additional text event, we need to fast-forward the
                  // lastLine and lastCol position to include the last text structure.
                  for (int i = lastStart; i < (lastStart + lastLen); i++) {
                      final char c = buffer[i];
                      if (c == '\n') {
                          lastLine++;
                          lastCol = 1;
                      } else {
                          lastCol++;
                      }
  
                  }
  
              }
  
              final long parsingEndTimeNanos = System.nanoTime();
              handler.handleDocumentEnd(parsingEndTimeNanos, (parsingEndTimeNanos - parsingStartTimeNanos), lastLine, lastCol);
  
          } catch (final ParseException e) {
              throw e;
          } catch (final Exception e) {
              throw new ParseException(e);
          }
  
      }
docs: /*
  This method is roughly equivalent to the one receiving a Reader, but oriented to parsing an already-existing
  buffer without the need to allocate one from the pool.