public class WriteOutContentHandler extends ContentHandlerDecorator
Constructor and Description |
---|
WriteOutContentHandler()
Creates a content handler that writes character events
to an internal string buffer.
|
WriteOutContentHandler(org.xml.sax.ContentHandler handler,
int writeLimit)
Creates a content handler that writes content up to the given
write limit to the given content handler.
|
WriteOutContentHandler(int writeLimit)
Creates a content handler that writes character events
to an internal string buffer.
|
WriteOutContentHandler(java.io.OutputStream stream)
Creates a content handler that writes character events to
the given output stream using the default encoding.
|
WriteOutContentHandler(java.io.Writer writer)
Creates a content handler that writes character events to
the given writer.
|
WriteOutContentHandler(java.io.Writer writer,
int writeLimit)
Creates a content handler that writes content up to the given
write limit to the given character stream.
|
Modifier and Type | Method and Description |
---|---|
void |
characters(char[] ch,
int start,
int length)
Writes the given characters to the given character stream.
|
void |
ignorableWhitespace(char[] ch,
int start,
int length) |
boolean |
isWriteLimitReached(java.lang.Throwable t)
Checks whether the given exception (or any of it's root causes) was
thrown by this handler as a signal of reaching the write limit.
|
endDocument, endElement, endPrefixMapping, processingInstruction, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, toString
public WriteOutContentHandler(org.xml.sax.ContentHandler handler, int writeLimit)
handler
- content handler to be decoratedwriteLimit
- write limitpublic WriteOutContentHandler(java.io.Writer writer, int writeLimit)
writer
- character streamwriteLimit
- write limitpublic WriteOutContentHandler(java.io.Writer writer)
writer
- writerpublic WriteOutContentHandler(java.io.OutputStream stream)
stream
- output streampublic WriteOutContentHandler(int writeLimit)
ContentHandlerDecorator.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 SAXException
is thrown.
The isWriteLimitReached(Throwable)
method can be used to
detect this case.
writeLimit
- maximum number of characters to include in the string,
or -1 to disable the write limitpublic WriteOutContentHandler()
ContentHandlerDecorator.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 SAXException
is thrown. The
isWriteLimitReached(Throwable)
method can be used to detect
this case.
public void characters(char[] ch, int start, int length) throws org.xml.sax.SAXException
characters
in interface org.xml.sax.ContentHandler
characters
in class ContentHandlerDecorator
org.xml.sax.SAXException
public void ignorableWhitespace(char[] ch, int start, int length) throws org.xml.sax.SAXException
ignorableWhitespace
in interface org.xml.sax.ContentHandler
ignorableWhitespace
in class ContentHandlerDecorator
org.xml.sax.SAXException
public boolean isWriteLimitReached(java.lang.Throwable t)
t
- throwabletrue
if the write limit was reached,
false
otherwiseCopyright © 2010 - 2020 Adobe. All Rights Reserved