@Override
    public void characters(char[] ch, int start, int length) throws SAXException {
        try {
            if (maxBufferLength > -1) {
                int remaining = maxBufferLength - stringBuilder.length();
                length = remaining > length ? length : remaining;
            }
            String text = new String(Arrays.copyOfRange(ch, start, start + length));
            stringBuilder.append(text);
            super.characters(ch, start, length);
        } catch (SAXException e) {
            handleException(e);
        }
    }
The characters method is called whenever a Parser wants to pass raw
characters to the ContentHandler. However, standard references are often
split across different calls to characters, depending on the specific
Parser used. Therefore, we simply add all characters to a StringBuilder
and analyze it once the document is finished.
tika-core/src/main/java/org/apache/tika/sax/StandardsExtractingContentHandler.java