SecureContentHandler extends ContentHandlerDecorator { @Override public void characters(char[] ch, int start, int length) throws SAXException { advance(length); super.characters(ch, start, length); } SecureContentHandler(
            ContentHandler handler, TikaInputStream stream); long getOutputThreshold(); void setOutputThreshold(long threshold); long getMaximumCompressionRatio(); void setMaximumCompressionRatio(long ratio); int getMaximumDepth(); void setMaximumPackageEntryDepth(int depth); int getMaximumPackageEntryDepth(); void setMaximumDepth(int depth); void throwIfCauseOf(SAXException e); @Override void startElement(
            String uri, String localName, String name, Attributes atts); @Override void endElement(
            String uri, String localName, String name); @Override void characters(char[] ch, int start, int length); @Override void ignorableWhitespace(char[] ch, int start, int length);  }
@Test public void testZeroCharactersPerByte() throws IOException { try { char[] ch = new char[] { 'x' }; for (int i = 0; i < MANY_BYTES; i++) { stream.read(); } handler.characters(ch, 0, 1); } catch (SAXException e) { fail("Unexpected SAXException"); } }
@Test public void testOneCharacterPerByte() throws IOException { try { char[] ch = new char[1]; for (int i = 0; i < MANY_BYTES; i++) { stream.read(); handler.characters(ch, 0, ch.length); } } catch (SAXException e) { fail("Unexpected SAXException"); } }
@Test public void testTenCharactersPerByte() throws IOException { try { char[] ch = new char[10]; for (int i = 0; i < MANY_BYTES; i++) { stream.read(); handler.characters(ch, 0, ch.length); } } catch (SAXException e) { fail("Unexpected SAXException"); } }
@Test public void testManyCharactersPerByte() throws IOException { try { char[] ch = new char[1000]; for (int i = 0; i < MANY_BYTES; i++) { stream.read(); handler.characters(ch, 0, ch.length); } fail("Expected SAXException not thrown"); } catch (SAXException e) { } }
@Test public void testSomeCharactersWithoutInput() throws IOException { try { char[] ch = new char[100]; for (int i = 0; i < 100; i++) { handler.characters(ch, 0, ch.length); } } catch (SAXException e) { fail("Unexpected SAXException"); } }
@Test public void testManyCharactersWithoutInput() throws IOException { try { char[] ch = new char[100]; for (int i = 0; i < 20000; i++) { handler.characters(ch, 0, ch.length); } fail("Expected SAXException not thrown"); } catch (SAXException e) { } }