public class StAXDocumentSerializer extends Encoder implements javax.xml.stream.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 javax.xml.stream.XMLStreamException
writeStartDocument in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument(String version) throws javax.xml.stream.XMLStreamException
writeStartDocument in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeStartDocument(String encoding, String version) throws javax.xml.stream.XMLStreamException
writeStartDocument in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEndDocument()
throws javax.xml.stream.XMLStreamException
writeEndDocument in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void close()
throws javax.xml.stream.XMLStreamException
close in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void flush()
throws javax.xml.stream.XMLStreamException
flush in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeStartElement(String localName) throws javax.xml.stream.XMLStreamException
writeStartElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeStartElement(String namespaceURI, String localName) throws javax.xml.stream.XMLStreamException
writeStartElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeStartElement(String prefix, String localName, String namespaceURI) throws javax.xml.stream.XMLStreamException
writeStartElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEmptyElement(String localName) throws javax.xml.stream.XMLStreamException
writeEmptyElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEmptyElement(String namespaceURI, String localName) throws javax.xml.stream.XMLStreamException
writeEmptyElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEmptyElement(String prefix, String localName, String namespaceURI) throws javax.xml.stream.XMLStreamException
writeEmptyElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEndElement()
throws javax.xml.stream.XMLStreamException
writeEndElement in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeAttribute(String localName, String value) throws javax.xml.stream.XMLStreamException
writeAttribute in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeAttribute(String namespaceURI, String localName, String value) throws javax.xml.stream.XMLStreamException
writeAttribute in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws javax.xml.stream.XMLStreamException
writeAttribute in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeNamespace(String prefix, String namespaceURI) throws javax.xml.stream.XMLStreamException
writeNamespace in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeDefaultNamespace(String namespaceURI) throws javax.xml.stream.XMLStreamException
writeDefaultNamespace in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeComment(String data) throws javax.xml.stream.XMLStreamException
writeComment in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeProcessingInstruction(String target) throws javax.xml.stream.XMLStreamException
writeProcessingInstruction in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeProcessingInstruction(String target, String data) throws javax.xml.stream.XMLStreamException
writeProcessingInstruction in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeCData(String text) throws javax.xml.stream.XMLStreamException
writeCData in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeDTD(String dtd) throws javax.xml.stream.XMLStreamException
writeDTD in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeEntityRef(String name) throws javax.xml.stream.XMLStreamException
writeEntityRef in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeCharacters(String text) throws javax.xml.stream.XMLStreamException
writeCharacters in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void writeCharacters(char[] text,
int start,
int len)
throws javax.xml.stream.XMLStreamException
writeCharacters in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic String getPrefix(String uri) throws javax.xml.stream.XMLStreamException
getPrefix in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void setPrefix(String prefix, String uri) throws javax.xml.stream.XMLStreamException
setPrefix in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void setDefaultNamespace(String uri) throws javax.xml.stream.XMLStreamException
setDefaultNamespace in interface javax.xml.stream.XMLStreamWriterjavax.xml.stream.XMLStreamExceptionpublic void setNamespaceContext(NamespaceContext context) throws javax.xml.stream.XMLStreamException
setNamespaceContext in interface javax.xml.stream.XMLStreamWritercontext - the namespace context to use for this writer, may not be nulljavax.xml.stream.XMLStreamExceptionpublic NamespaceContext getNamespaceContext()
getNamespaceContext in interface javax.xml.stream.XMLStreamWriterpublic Object getProperty(String name) throws IllegalArgumentException
getProperty in interface javax.xml.stream.XMLStreamWriterIllegalArgumentExceptionpublic void setManager(StAXManager manager)
public void setEncoding(String encoding)
public void writeOctets(byte[] b,
int start,
int len)
throws javax.xml.stream.XMLStreamException
protected void encodeTerminationAndCurrentElement(boolean terminateAfter)
throws javax.xml.stream.XMLStreamException
public final void initiateLowLevelWriting()
throws javax.xml.stream.XMLStreamException
LowLevelFastInfosetStreamWriterThis method must be invoked before other low level method.
initiateLowLevelWriting in interface LowLevelFastInfosetStreamWriterjavax.xml.stream.XMLStreamExceptionpublic 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 © 2012 Oracle Corpration. All Rights Reserved.