public class TextAccumulatorHandler extends org.xml.sax.helpers.DefaultHandler
TextAccumulatorHandler simply accumulates all text
content events into a single string buffer. The buffer is reset
with each start document event, but is never freed entirely from
memory.| Constructor and Description |
|---|
TextAccumulatorHandler()
Construct a text accumulator handler.
|
TextAccumulatorHandler(int minBufLength)
Construct a text accumulator handler with the specified
initial buffer length.
|
| Modifier and Type | Method and Description |
|---|---|
void |
characters(char[] cs,
int start,
int length)
Adds the specified character slice to the string buffer.
|
String |
getText()
Returns the text thus far accumulated.
|
void |
reset()
Resets the underlying string buffer to the empty state by
assigning it to a new buffer of the specified minimum length.
|
void |
startDocument()
Resets the string buffer.
|
String |
toString()
A convenience implementation returning the same value as
getText(), namely the text thus far accumulated. |
endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startElement, startPrefixMapping, unparsedEntityDecl, warningpublic TextAccumulatorHandler()
public TextAccumulatorHandler(int minBufLength)
minBufLength - Minimum buffer length to assign to string buffer.public void reset()
public void startDocument()
startDocument in interface ContentHandlerstartDocument in class org.xml.sax.helpers.DefaultHandlerpublic void characters(char[] cs,
int start,
int length)
characters in interface ContentHandlercharacters in class org.xml.sax.helpers.DefaultHandlercs - Characters underlying slice.start - Index of first character in slice.length - Number of characters in slice.public String getText()
Copyright © 2016 Alias-i, Inc.. All rights reserved.