org.apache.tika.sax
Class BodyContentHandler

java.lang.Object
  extended by org.xml.sax.helpers.DefaultHandler
      extended by org.apache.tika.sax.ContentHandlerDecorator
          extended by org.apache.tika.sax.BodyContentHandler
All Implemented Interfaces:
org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler

public class BodyContentHandler
extends ContentHandlerDecorator

Content handler decorator that only passes everything inside the XHTML <body/> tag to the underlying handler. Note that the <body/> tag itself is not passed on.


Constructor Summary
BodyContentHandler()
          Creates a content handler that writes XHTML body character events to an internal string buffer.
BodyContentHandler(org.xml.sax.ContentHandler handler)
          Creates a content handler that passes all XHTML body events to the given underlying content handler.
BodyContentHandler(int writeLimit)
          Creates a content handler that writes XHTML body character events to an internal string buffer.
BodyContentHandler(java.io.OutputStream stream)
          Creates a content handler that writes XHTML body character events to the given output stream using the default encoding.
BodyContentHandler(java.io.Writer writer)
          Creates a content handler that writes XHTML body character events to the given writer.
 
Method Summary
 
Methods inherited from class org.apache.tika.sax.ContentHandlerDecorator
characters, endDocument, endElement, endPrefixMapping, handleException, ignorableWhitespace, processingInstruction, setContentHandler, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, toString
 
Methods inherited from class org.xml.sax.helpers.DefaultHandler
error, fatalError, notationDecl, resolveEntity, unparsedEntityDecl, warning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BodyContentHandler

public BodyContentHandler(org.xml.sax.ContentHandler handler)
Creates a content handler that passes all XHTML body events to the given underlying content handler.

Parameters:
handler - content handler

BodyContentHandler

public BodyContentHandler(java.io.Writer writer)
Creates a content handler that writes XHTML body character events to the given writer.

Parameters:
writer - writer

BodyContentHandler

public BodyContentHandler(java.io.OutputStream stream)
Creates a content handler that writes XHTML body character events to the given output stream using the default encoding.

Parameters:
stream - output stream

BodyContentHandler

public BodyContentHandler(int writeLimit)
Creates a content handler that writes XHTML body character events to an internal string buffer. The contents of the buffer can be retrieved using the ContentHandlerDecorator.toString() method.

The internal string buffer is bounded at the given number of characters. If this write limit is reached, then a SAXException is thrown.

Parameters:
writeLimit - maximum number of characters to include in the string, or -1 to disable the write limit
Since:
Apache Tika 0.7

BodyContentHandler

public BodyContentHandler()
Creates a content handler that writes XHTML body character events to an internal string buffer. The contents of the buffer can be retrieved using the ContentHandlerDecorator.toString() method.

The internal string buffer is bounded at 100k characters. If this write limit is reached, then a SAXException is thrown.



Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.