Package org.apache.axiom.ext.stax
Interface CharacterDataReader
-
public interface CharacterDataReader
Optional interface implemented byXMLStreamReader
implementations that support writing character data directly to aWriter
.All the requirements outlined in
org.apache.axiom.ext.stax
apply to this extension interface. In particular, to get a reference to the extension, the consumer MUST callXMLStreamReader.getProperty(String)
withPROPERTY
as the property name.
-
-
Field Summary
Fields Modifier and Type Field Description static String
PROPERTY
The name of the property used to look up this extension interface from aXMLStreamReader
implementation.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
writeTextTo(Writer writer)
Output the character data for the current event to the given writer.
-
-
-
Field Detail
-
PROPERTY
static final String PROPERTY
The name of the property used to look up this extension interface from aXMLStreamReader
implementation.
-
-
Method Detail
-
writeTextTo
void writeTextTo(Writer writer) throws XMLStreamException, IOException
Output the character data for the current event to the given writer. In general, the implementation behaves such thatreader.writeTextTo(writer)
has the same effect aswriter.write(reader.getText())
. However, the implementation MAY choose to split the character data differently. E.g. it MAY write the character data in multiple chunks or it MAY choose to process more character data in a single event than would be returned byXMLStreamReader.getText()
. Therefore, using this method together withXMLStreamReader.getText()
,XMLStreamReader.getTextCharacters()
,XMLStreamReader.getTextStart()
,XMLStreamReader.getTextLength()
orXMLStreamReader.getTextCharacters(int, char[], int, int)
is not supported and may lead to undefined results.The implementation SHOULD avoid any unnecessary conversions between strings and character arrays.
- Parameters:
writer
- the writer to write the character data to- Throws:
XMLStreamException
- if the underlying XML source is not well-formedIOException
- if an I/O error occurs when writing the character dataIllegalStateException
- if this state is not a valid text state.
-
-