public class StAXDocumentSerializer extends Encoder implements XMLStreamWriter, LowLevelFastInfosetStreamWriter
Instantiate this serializer to serialize a fast infoset document in accordance with the StAX API.
More than one fast infoset document may be encoded to the
OutputStream
.
Modifier and Type | Field and Description |
---|---|
protected String[] |
_attributesArray
List of attributes qnames and values defined in the current element.
|
protected int |
_attributesArrayIndex |
protected String |
_currentLocalName
Local name of current element.
|
protected String |
_currentPrefix
Prefix of current element.
|
protected String |
_currentUri
Namespace of current element.
|
protected String |
_encoding |
protected boolean |
_inStartElement
This flag indicates when there is a pending start element event.
|
protected boolean |
_isEmptyElement
This flag indicates if the current element is empty.
|
protected StAXManager |
_manager |
protected String[] |
_namespacesArray
List of namespaces defined in the current element.
|
protected int |
_namespacesArrayIndex |
protected NamespaceContextImplementation |
_nsContext
Mapping between uris and prefixes.
|
protected boolean[] |
_nsSupportContextStack |
protected int |
_stackCount |
_b, _characterEncodingSchemeSystemDefault, _charBuffer, _markIndex, _octetBuffer, _octetBufferIndex, _s, _terminate, _v, _vData, attributeValueMapTotalCharactersConstraint, CHARACTER_ENCODING_SCHEME_SYSTEM_PROPERTY, characterContentChunkMapTotalCharactersConstraint, maxAttributeValueSize, maxCharacterContentChunkSize, minAttributeValueSize, minCharacterContentChunkSize
ATTRIBUTE_VALUE_MAP_MEMORY_CONSTRAINT, BUFFER_SIZE_PROPERTY, CHARACTER_CONTENT_CHUNK_MAP_MEMORY_CONSTRAINT, EXTERNAL_VOCABULARIES_PROPERTY, IGNORE_COMMENTS_FEATURE, IGNORE_DTD_FEATURE, IGNORE_PROCESSING_INSTRUCTIONS_FEATURE, IGNORE_WHITE_SPACE_TEXT_CONTENT_FEATURE, MAX_ATTRIBUTE_VALUE_SIZE, MAX_CHARACTER_CONTENT_CHUNK_SIZE, MIN_ATTRIBUTE_VALUE_SIZE, MIN_CHARACTER_CONTENT_CHUNK_SIZE, REGISTERED_ENCODING_ALGORITHMS_PROPERTY, UTF_16BE, UTF_8
Constructor and Description |
---|
StAXDocumentSerializer() |
StAXDocumentSerializer(OutputStream outputStream) |
StAXDocumentSerializer(OutputStream outputStream,
StAXManager manager) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
encodeTerminationAndCurrentElement(boolean terminateAfter) |
void |
flush() |
int |
getLocalNameIndex()
Get the current index that was applied to an [local name] of an
Element or Attribute Information Item.
|
NamespaceContext |
getNamespaceContext() |
int |
getNextAttributeIndex()
Get the next index to apply to an Attribute Information Item.
|
int |
getNextElementIndex()
Get the next index to apply to an Element Information Item.
|
int |
getNextLocalNameIndex()
Get the next index to apply to an [local name] of an Element or Attribute
Information Item.
|
String |
getPrefix(String uri) |
Object |
getProperty(String name) |
void |
initiateLowLevelWriting()
Initiate low level writing of an element fragment.
|
void |
reset()
Reset the encoder for reuse encoding another XML infoset.
|
void |
setDefaultNamespace(String uri) |
void |
setEncoding(String encoding) |
void |
setManager(StAXManager manager) |
void |
setNamespaceContext(NamespaceContext context)
Sets the current namespace context for prefix and uri bindings.
|
void |
setPrefix(String prefix,
String uri) |
void |
writeAttribute(String localName,
String value) |
void |
writeAttribute(String namespaceURI,
String localName,
String value) |
void |
writeAttribute(String prefix,
String namespaceURI,
String localName,
String value) |
void |
writeCData(String text) |
void |
writeCharacters(char[] text,
int start,
int len) |
void |
writeCharacters(String text) |
void |
writeComment(String data) |
void |
writeDefaultNamespace(String namespaceURI) |
void |
writeDTD(String dtd) |
void |
writeEmptyElement(String localName) |
void |
writeEmptyElement(String namespaceURI,
String localName) |
void |
writeEmptyElement(String prefix,
String localName,
String namespaceURI) |
void |
writeEndDocument() |
void |
writeEndElement() |
void |
writeEntityRef(String name) |
boolean |
writeLowLevelAttribute(String prefix,
String namespaceURI,
String localName)
Write an attribute.
|
void |
writeLowLevelAttributeIndexed(int index) |
void |
writeLowLevelAttributeValue(String value) |
void |
writeLowLevelEndElement() |
void |
writeLowLevelEndNamespaces() |
void |
writeLowLevelEndStartElement() |
void |
writeLowLevelNamespace(String prefix,
String namespaceName) |
void |
writeLowLevelOctets(byte[] octets,
int length) |
void |
writeLowLevelStartAttributes() |
boolean |
writeLowLevelStartElement(int type,
String prefix,
String localName,
String namespaceURI)
Write the start of an element.
|
void |
writeLowLevelStartElementIndexed(int type,
int index) |
void |
writeLowLevelStartNameLiteral(int type,
String prefix,
byte[] utf8LocalName,
String namespaceURI) |
void |
writeLowLevelStartNameLiteral(int type,
String prefix,
int localNameIndex,
String namespaceURI) |
void |
writeLowLevelStartNamespaces() |
void |
writeLowLevelTerminationAndMark() |
void |
writeLowLevelText(char[] text,
int length) |
void |
writeLowLevelText(String text) |
void |
writeNamespace(String prefix,
String namespaceURI) |
void |
writeOctets(byte[] b,
int start,
int len) |
void |
writeProcessingInstruction(String target) |
void |
writeProcessingInstruction(String target,
String data) |
void |
writeStartDocument() |
void |
writeStartDocument(String version) |
void |
writeStartDocument(String encoding,
String version) |
void |
writeStartElement(String localName) |
void |
writeStartElement(String namespaceURI,
String localName) |
void |
writeStartElement(String prefix,
String localName,
String namespaceURI) |
canAddAttributeToTable, canAddCharacterContentToTable, encodeAIIBuiltInAlgorithmData, encodeAIIObjectAlgorithmData, encodeAIIOctetAlgorithmData, encodeAlphabetCharacters, encodeAttributeQualifiedNameOnSecondBit, encodeCharacters, encodeCharactersNoClone, encodeCIIBuiltInAlgorithmData, encodeCIIBuiltInAlgorithmDataAsCDATA, encodeCIIObjectAlgorithmData, encodeCIIOctetAlgorithmData, encodeComment, encodeCommentNoClone, encodeDateTimeFourBitCharacters, encodeDateTimeNonIdentifyingStringOnFirstBit, encodeDocumentTermination, encodeDocumentTypeDeclaration, encodeElementQualifiedNameOnThirdBit, encodeElementTermination, encodeFourBitCharacters, encodeHeader, encodeIdentifyingNonEmptyStringOnFirstBit, encodeInitialVocabulary, encodeLiteralAttributeQualifiedNameOnSecondBit, encodeLiteralElementQualifiedNameOnThirdBit, encodeNamespaceAttribute, encodeNonEmptyCharacterStringOnFifthBit, encodeNonEmptyCharacterStringOnFifthBit, encodeNonEmptyCharacterStringOnSeventhBit, encodeNonEmptyFourBitCharacterString, encodeNonEmptyFourBitCharacterStringOnSeventhBit, encodeNonEmptyNBitCharacterStringOnSeventhBit, encodeNonEmptyOctetStringOnSecondBit, encodeNonEmptyUTF8StringAsOctetString, encodeNonEmptyUTF8StringAsOctetString, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnFirstBit, encodeNonIdentifyingStringOnThirdBit, encodeNonIdentifyingStringOnThirdBit, encodeNonIdentifyingStringOnThirdBit, encodeNonZeroInteger, encodeNonZeroIntegerOnFourthBit, encodeNonZeroIntegerOnSecondBitFirstBitOne, encodeNonZeroIntegerOnSecondBitFirstBitZero, encodeNonZeroIntegerOnThirdBit, encodeNonZeroOctetStringLength, encodeNonZeroOctetStringLengthOnFifthBit, encodeNonZeroOctetStringLengthOnSecondBit, encodeNonZeroOctetStringLengthOnSenventhBit, encodeNumericFourBitCharacters, encodeNumericNonIdentifyingStringOnFirstBit, encodeProcessingInstruction, encodeTermination, encodeUtf16String, encodeUtf16String, encodeUTF8String, encodeUTF8String, getAttributeValueMapMemoryLimit, getCharacterContentChunkMapMemoryLimit, getCharacterEncodingScheme, getIgnoreComments, getIgnoreDTD, getIgnoreProcesingInstructions, getIgnoreWhiteSpaceTextContent, getMaxAttributeValueSize, getMaxCharacterContentChunkSize, getMinAttributeValueSize, getMinCharacterContentChunkSize, getPrefixFromQualifiedName, getRegisteredEncodingAlgorithms, getVocabularyApplicationData, hasMark, isAttributeValueLengthMatchesLimit, isCharacterContentChunkLengthMatchesLimit, isWhiteSpace, isWhiteSpace, mark, resetMark, setAttributeValueMapMemoryLimit, setCharacterContentChunkMapMemoryLimit, setCharacterEncodingScheme, setExternalVocabulary, setIgnoreComments, setIgnoreDTD, setIgnoreProcesingInstructions, setIgnoreWhiteSpaceTextContent, setMaxAttributeValueSize, setMaxCharacterContentChunkSize, setMinAttributeValueSize, setMinCharacterContentChunkSize, setOutputStream, setRegisteredEncodingAlgorithms, setVocabulary, setVocabularyApplicationData, write, write, write
characters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warning
protected StAXManager _manager
protected String _encoding
protected String _currentLocalName
protected String _currentUri
protected String _currentPrefix
protected boolean _inStartElement
protected boolean _isEmptyElement
protected String[] _attributesArray
protected int _attributesArrayIndex
protected boolean[] _nsSupportContextStack
protected int _stackCount
protected NamespaceContextImplementation _nsContext
protected String[] _namespacesArray
protected int _namespacesArrayIndex
public StAXDocumentSerializer()
public StAXDocumentSerializer(OutputStream outputStream)
public StAXDocumentSerializer(OutputStream outputStream, StAXManager manager)
public void reset()
Encoder
reset
in interface FastInfosetSerializer
reset
in class Encoder
public void writeStartDocument() throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument(String version) throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument
in interface XMLStreamWriter
XMLStreamException
public void writeEndDocument() throws XMLStreamException
writeEndDocument
in interface XMLStreamWriter
XMLStreamException
public void close() throws XMLStreamException
close
in interface XMLStreamWriter
XMLStreamException
public void flush() throws XMLStreamException
flush
in interface XMLStreamWriter
XMLStreamException
public void writeStartElement(String localName) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeStartElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String localName) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
XMLStreamException
public void writeEndElement() throws XMLStreamException
writeEndElement
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
XMLStreamException
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
writeNamespace
in interface XMLStreamWriter
XMLStreamException
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace
in interface XMLStreamWriter
XMLStreamException
public void writeComment(String data) throws XMLStreamException
writeComment
in interface XMLStreamWriter
XMLStreamException
public void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction
in interface XMLStreamWriter
XMLStreamException
public void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction
in interface XMLStreamWriter
XMLStreamException
public void writeCData(String text) throws XMLStreamException
writeCData
in interface XMLStreamWriter
XMLStreamException
public void writeDTD(String dtd) throws XMLStreamException
writeDTD
in interface XMLStreamWriter
XMLStreamException
public void writeEntityRef(String name) throws XMLStreamException
writeEntityRef
in interface XMLStreamWriter
XMLStreamException
public void writeCharacters(String text) throws XMLStreamException
writeCharacters
in interface XMLStreamWriter
XMLStreamException
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException
writeCharacters
in interface XMLStreamWriter
XMLStreamException
public String getPrefix(String uri) throws XMLStreamException
getPrefix
in interface XMLStreamWriter
XMLStreamException
public void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix
in interface XMLStreamWriter
XMLStreamException
public void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace
in interface XMLStreamWriter
XMLStreamException
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext
in interface XMLStreamWriter
context
- the namespace context to use for this writer, may not be nullXMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLStreamWriter
public Object getProperty(String name) throws IllegalArgumentException
getProperty
in interface XMLStreamWriter
IllegalArgumentException
public void setManager(StAXManager manager)
public void setEncoding(String encoding)
public void writeOctets(byte[] b, int start, int len) throws XMLStreamException
XMLStreamException
protected void encodeTerminationAndCurrentElement(boolean terminateAfter) throws XMLStreamException
XMLStreamException
public final void initiateLowLevelWriting() throws XMLStreamException
LowLevelFastInfosetStreamWriter
This method must be invoked before other low level method.
initiateLowLevelWriting
in interface LowLevelFastInfosetStreamWriter
XMLStreamException
public final int getNextElementIndex()
LowLevelFastInfosetStreamWriter
This will increment the next obtained index such that:
i = w.getNextElementIndex(); j = w.getNextElementIndex(); i == j + 1;
getNextElementIndex
in interface LowLevelFastInfosetStreamWriter
public final int getNextAttributeIndex()
LowLevelFastInfosetStreamWriter
i = w.getNextAttributeIndex(); j = w.getNextAttributeIndex(); i == j + 1;
getNextAttributeIndex
in interface LowLevelFastInfosetStreamWriter
public final int getLocalNameIndex()
LowLevelFastInfosetStreamWriter
getLocalNameIndex
in interface LowLevelFastInfosetStreamWriter
public final int getNextLocalNameIndex()
LowLevelFastInfosetStreamWriter
i = w.getNextLocalNameIndex(); j = w.getNextLocalNameIndex(); i == j + 1;
getNextLocalNameIndex
in interface LowLevelFastInfosetStreamWriter
public final void writeLowLevelTerminationAndMark() throws IOException
writeLowLevelTerminationAndMark
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelStartElementIndexed(int type, int index) throws IOException
writeLowLevelStartElementIndexed
in interface LowLevelFastInfosetStreamWriter
IOException
public final boolean writeLowLevelStartElement(int type, String prefix, String localName, String namespaceURI) throws IOException
LowLevelFastInfosetStreamWriter
writeLowLevelStartElement
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelStartNamespaces() throws IOException
writeLowLevelStartNamespaces
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelNamespace(String prefix, String namespaceName) throws IOException
writeLowLevelNamespace
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelEndNamespaces() throws IOException
writeLowLevelEndNamespaces
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelStartAttributes() throws IOException
writeLowLevelStartAttributes
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelAttributeIndexed(int index) throws IOException
writeLowLevelAttributeIndexed
in interface LowLevelFastInfosetStreamWriter
IOException
public final boolean writeLowLevelAttribute(String prefix, String namespaceURI, String localName) throws IOException
LowLevelFastInfosetStreamWriter
writeLowLevelAttribute
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelAttributeValue(String value) throws IOException
writeLowLevelAttributeValue
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelStartNameLiteral(int type, String prefix, byte[] utf8LocalName, String namespaceURI) throws IOException
writeLowLevelStartNameLiteral
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelStartNameLiteral(int type, String prefix, int localNameIndex, String namespaceURI) throws IOException
writeLowLevelStartNameLiteral
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelEndStartElement() throws IOException
writeLowLevelEndStartElement
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelEndElement() throws IOException
writeLowLevelEndElement
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelText(char[] text, int length) throws IOException
writeLowLevelText
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelText(String text) throws IOException
writeLowLevelText
in interface LowLevelFastInfosetStreamWriter
IOException
public final void writeLowLevelOctets(byte[] octets, int length) throws IOException
writeLowLevelOctets
in interface LowLevelFastInfosetStreamWriter
IOException
Copyright © 2020 Oracle Corpration. All rights reserved.