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, minCharacterContentChunkSizeATTRIBUTE_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, writecharacters, endDocument, endElement, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startDocument, startElement, startPrefixMapping, unparsedEntityDecl, warningprotected 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()
Encoderreset in interface FastInfosetSerializerreset in class Encoderpublic void writeStartDocument()
throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartDocument(String encoding, String version) throws XMLStreamException
writeStartDocument in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndDocument()
throws XMLStreamException
writeEndDocument in interface XMLStreamWriterXMLStreamExceptionpublic void close()
throws XMLStreamException
close in interface XMLStreamWriterXMLStreamExceptionpublic void flush()
throws XMLStreamException
flush in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String namespaceURI, String localName) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeStartElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String localName) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
writeEmptyElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeEndElement()
throws XMLStreamException
writeEndElement in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
writeAttribute in interface XMLStreamWriterXMLStreamExceptionpublic void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
writeNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
writeDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void writeComment(String data) throws XMLStreamException
writeComment in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeProcessingInstruction(String target, String data) throws XMLStreamException
writeProcessingInstruction in interface XMLStreamWriterXMLStreamExceptionpublic void writeCData(String text) throws XMLStreamException
writeCData in interface XMLStreamWriterXMLStreamExceptionpublic void writeDTD(String dtd) throws XMLStreamException
writeDTD in interface XMLStreamWriterXMLStreamExceptionpublic void writeEntityRef(String name) throws XMLStreamException
writeEntityRef in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(String text) throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic void writeCharacters(char[] text,
int start,
int len)
throws XMLStreamException
writeCharacters in interface XMLStreamWriterXMLStreamExceptionpublic String getPrefix(String uri) throws XMLStreamException
getPrefix in interface XMLStreamWriterXMLStreamExceptionpublic void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix in interface XMLStreamWriterXMLStreamExceptionpublic void setDefaultNamespace(String uri) throws XMLStreamException
setDefaultNamespace in interface XMLStreamWriterXMLStreamExceptionpublic void setNamespaceContext(NamespaceContext context) throws XMLStreamException
setNamespaceContext in interface XMLStreamWritercontext - the namespace context to use for this writer, may not be nullXMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface XMLStreamWriterpublic Object getProperty(String name) throws IllegalArgumentException
getProperty in interface XMLStreamWriterIllegalArgumentExceptionpublic void setManager(StAXManager manager)
public void setEncoding(String encoding)
public void writeOctets(byte[] b,
int start,
int len)
throws XMLStreamException
XMLStreamExceptionprotected void encodeTerminationAndCurrentElement(boolean terminateAfter)
throws XMLStreamException
XMLStreamExceptionpublic final void initiateLowLevelWriting()
throws XMLStreamException
LowLevelFastInfosetStreamWriterThis method must be invoked before other low level method.
initiateLowLevelWriting in interface LowLevelFastInfosetStreamWriterXMLStreamExceptionpublic final int getNextElementIndex()
LowLevelFastInfosetStreamWriterThis will increment the next obtained index such that:
i = w.getNextElementIndex(); j = w.getNextElementIndex(); i == j + 1;
getNextElementIndex in interface LowLevelFastInfosetStreamWriterpublic final int getNextAttributeIndex()
LowLevelFastInfosetStreamWriteri = w.getNextAttributeIndex(); j = w.getNextAttributeIndex(); i == j + 1;
getNextAttributeIndex in interface LowLevelFastInfosetStreamWriterpublic final int getLocalNameIndex()
LowLevelFastInfosetStreamWritergetLocalNameIndex in interface LowLevelFastInfosetStreamWriterpublic final int getNextLocalNameIndex()
LowLevelFastInfosetStreamWriteri = w.getNextLocalNameIndex(); j = w.getNextLocalNameIndex(); i == j + 1;
getNextLocalNameIndex in interface LowLevelFastInfosetStreamWriterpublic final void writeLowLevelTerminationAndMark()
throws IOException
writeLowLevelTerminationAndMark in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelStartElementIndexed(int type,
int index)
throws IOException
writeLowLevelStartElementIndexed in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final boolean writeLowLevelStartElement(int type,
String prefix,
String localName,
String namespaceURI)
throws IOException
LowLevelFastInfosetStreamWriterwriteLowLevelStartElement in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelStartNamespaces()
throws IOException
writeLowLevelStartNamespaces in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelNamespace(String prefix, String namespaceName) throws IOException
writeLowLevelNamespace in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelEndNamespaces()
throws IOException
writeLowLevelEndNamespaces in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelStartAttributes()
throws IOException
writeLowLevelStartAttributes in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelAttributeIndexed(int index)
throws IOException
writeLowLevelAttributeIndexed in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final boolean writeLowLevelAttribute(String prefix, String namespaceURI, String localName) throws IOException
LowLevelFastInfosetStreamWriterwriteLowLevelAttribute in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelAttributeValue(String value) throws IOException
writeLowLevelAttributeValue in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelStartNameLiteral(int type,
String prefix,
byte[] utf8LocalName,
String namespaceURI)
throws IOException
writeLowLevelStartNameLiteral in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelStartNameLiteral(int type,
String prefix,
int localNameIndex,
String namespaceURI)
throws IOException
writeLowLevelStartNameLiteral in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelEndStartElement()
throws IOException
writeLowLevelEndStartElement in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelEndElement()
throws IOException
writeLowLevelEndElement in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelText(char[] text,
int length)
throws IOException
writeLowLevelText in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelText(String text) throws IOException
writeLowLevelText in interface LowLevelFastInfosetStreamWriterIOExceptionpublic final void writeLowLevelOctets(byte[] octets,
int length)
throws IOException
writeLowLevelOctets in interface LowLevelFastInfosetStreamWriterIOExceptionCopyright © 2005–2017 Oracle Corporation. All rights reserved.