Package org.apache.tika.sax
Class WriteOutContentHandler
- java.lang.Object
- 
- org.xml.sax.helpers.DefaultHandler
- 
- org.apache.tika.sax.ContentHandlerDecorator
- 
- org.apache.tika.sax.WriteOutContentHandler
 
 
 
- 
- All Implemented Interfaces:
- ContentHandler,- DTDHandler,- EntityResolver,- ErrorHandler
 - Direct Known Subclasses:
- LanguageHandler,- RichTextContentHandler
 
 public class WriteOutContentHandler extends ContentHandlerDecorator SAX event handler that writes content up to an optional write limit out to a character stream or other decorated handler.
- 
- 
Constructor SummaryConstructors Constructor Description WriteOutContentHandler()Creates a content handler that writes character events to an internal string buffer.WriteOutContentHandler(int writeLimit)Creates a content handler that writes character events to an internal string buffer.WriteOutContentHandler(OutputStream stream)Deprecated.-- please useWriteOutContentHandler(Writer)WriteOutContentHandler(Writer writer)Creates a content handler that writes character events to the given writer.WriteOutContentHandler(Writer writer, int writeLimit)Creates a content handler that writes content up to the given write limit to the given character stream.WriteOutContentHandler(ContentHandler handler, int writeLimit)Creates a content handler that writes content up to the given write limit to the given content handler.WriteOutContentHandler(ContentHandler handler, int writeLimit, boolean throwOnWriteLimitReached, ParseContext parseContext)The default is to throw aWriteLimitReachedException
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcharacters(char[] ch, int start, int length)Writes the given characters to the given character stream.voidignorableWhitespace(char[] ch, int start, int length)- 
Methods inherited from class org.apache.tika.sax.ContentHandlerDecoratorendDocument, endElement, endPrefixMapping, error, fatalError, handleException, processingInstruction, setContentHandler, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, toString, warning
 - 
Methods inherited from class org.xml.sax.helpers.DefaultHandlernotationDecl, resolveEntity, unparsedEntityDecl
 
- 
 
- 
- 
- 
Constructor Detail- 
WriteOutContentHandlerpublic WriteOutContentHandler(ContentHandler handler, int writeLimit) Creates a content handler that writes content up to the given write limit to the given content handler.- Parameters:
- handler- content handler to be decorated
- writeLimit- write limit
- Since:
- Apache Tika 0.10
 
 - 
WriteOutContentHandlerpublic WriteOutContentHandler(Writer writer, int writeLimit) Creates a content handler that writes content up to the given write limit to the given character stream.- Parameters:
- writer- character stream
- writeLimit- write limit
- Since:
- Apache Tika 0.10
 
 - 
WriteOutContentHandlerpublic WriteOutContentHandler(Writer writer) Creates a content handler that writes character events to the given writer.- Parameters:
- writer- writer
 
 - 
WriteOutContentHandler@Deprecated public WriteOutContentHandler(OutputStream stream) Deprecated.-- please useWriteOutContentHandler(Writer)Creates a content handler that writes character events to the given output stream using the default encoding.- Parameters:
- stream- output stream
 
 - 
WriteOutContentHandlerpublic WriteOutContentHandler(int writeLimit) Creates a content handler that writes character events to an internal string buffer. Use theContentHandlerDecorator.toString()method to access the collected character content.The internal string buffer is bounded at the given number of characters. If this write limit is reached, then a SAXExceptionis thrown. TheWriteLimitReachedException.isWriteLimitReached(Throwable)method can be used to detect this case.- Parameters:
- writeLimit- maximum number of characters to include in the string, or -1 to disable the write limit
- Since:
- Apache Tika 0.7
 
 - 
WriteOutContentHandlerpublic WriteOutContentHandler() Creates a content handler that writes character events to an internal string buffer. Use theContentHandlerDecorator.toString()method to access the collected character content.The internal string buffer is bounded at 100k characters. If this write limit is reached, then a SAXExceptionis thrown. TheWriteLimitReachedException.isWriteLimitReached(Throwable)method can be used to detect this case.
 - 
WriteOutContentHandlerpublic WriteOutContentHandler(ContentHandler handler, int writeLimit, boolean throwOnWriteLimitReached, ParseContext parseContext) The default is to throw aWriteLimitReachedException- Parameters:
- handler-
- writeLimit-
- throwOnWriteLimitReached-
- parseContext-
 
 
- 
 - 
Method Detail- 
characterspublic void characters(char[] ch, int start, int length) throws SAXExceptionWrites the given characters to the given character stream.- Specified by:
- charactersin interface- ContentHandler
- Overrides:
- charactersin class- ContentHandlerDecorator
- Throws:
- SAXException
 
 - 
ignorableWhitespacepublic void ignorableWhitespace(char[] ch, int start, int length) throws SAXException- Specified by:
- ignorableWhitespacein interface- ContentHandler
- Overrides:
- ignorableWhitespacein class- ContentHandlerDecorator
- Throws:
- SAXException
 
 
- 
 
-