XmlOutput for StAXDocumentSerializer.
This class is responsible for managing the indexing of elements, attributes and local names that are known to JAXB by way of the JAXBContext (generated from JAXB beans or schema). The pre-encoded UTF-8 representations of known local names are also utilized.
The lookup of elements, attributes and local names with respect to a context is very efficient. It relies on an incrementing base line so that look up is performed in O(1) time and only uses static memory. When the base line reaches a point where integer overflow will occur the arrays and base line are reset (such an event is rare and will have little impact on performance).
A weak map of JAXB contexts to optimized tables for attributes, elements and local names is utilized and stored on the LowLevel StAX serializer. Thus, optimized serializing can work other multiple serializing of JAXB beans using the same LowLevel StAX serializer instance. This approach works best when JAXB contexts are only created once per schema or JAXB beans (which is the recommended practice as the creation JAXB contexts are expensive, they are thread safe and can be reused).
| Modifier and Type | Class and Description |
|---|---|
| pack-priv static class | FastInfosetStreamWriterOutput.
Holder of JAXB contexts -> tables. |
| pack-priv static class | FastInfosetStreamWriterOutput.
Holder for the optimzed element, attribute and local name tables. |
| Modifier and Type | Field and Description |
|---|---|
| private final StAXDocumentSerializer | |
| private final Encoded[] | |
| private final FastInfosetStreamWriterOutput. |
| Access | Constructor and Description |
|---|---|
| public |
| fiout | back to summary |
|---|---|
| private final StAXDocumentSerializer fiout | |
| localNames | back to summary |
|---|---|
| private final Encoded[] localNames | |
| tables | back to summary |
|---|---|
| private final FastInfosetStreamWriterOutput. | |
| FastInfosetStreamWriterOutput | back to summary |
|---|---|
| public FastInfosetStreamWriterOutput(StAXDocumentSerializer out, JAXBContextImpl context) | |
| attribute | back to summary |
|---|---|
| public void attribute(Name name, String value) throws IOException Overrides org. Implements org.
| |
| attribute | back to summary |
|---|---|
| public void attribute(int prefix, String localName, String value) throws IOException Overrides org. Implements org.
| |
| beginStartTag | back to summary |
|---|---|
| public void beginStartTag(Name name) throws IOException Overrides org. Implements org. Doc from org. Writes a start tag.
At this point This method is used for writing tags that are indexed.
| |
| beginStartTag | back to summary |
|---|---|
| public void beginStartTag(int prefix, String localName) throws IOException Overrides org. Implements org.
| |
| beginStartTagWithNamespaces | back to summary |
|---|---|
| public void beginStartTagWithNamespaces(Name name) throws IOException | |
| endDocument | back to summary |
|---|---|
| public void endDocument(boolean fragment) throws IOException, SAXException, XMLStreamException Overrides org. Implements org. Doc from org. Called at the very end.
| |
| endStartTag | back to summary |
|---|---|
| public void endStartTag() throws IOException Overrides org. Implements org.
| |
| endTag | back to summary |
|---|---|
| public void endTag(Name name) throws IOException Overrides org. Implements org.
| |
| endTag | back to summary |
|---|---|
| public void endTag(int prefix, String localName) throws IOException Overrides org. Implements org.
| |
| startDocument | back to summary |
|---|---|
| public void startDocument(XMLSerializer serializer, boolean fragment, int[] nsUriIndex2prefixIndex, NamespaceContextImpl nsContext) throws IOException, SAXException, XMLStreamException Overrides org. Implements org. Doc from org. Called at the very beginning.
| |
| text | back to summary |
|---|---|
| public void text(Pcdata value, boolean needsSeparatingWhitespace) throws IOException Overrides org. Implements org. Doc from org. Writes XML text with character escaping, if necessary.
| |
| text | back to summary |
|---|---|
| public void text(String value, boolean needsSeparatingWhitespace) throws IOException Overrides org. Implements org. Doc from org. Writes XML text with character escaping, if necessary.
| |
| writeLiteral | back to summary |
|---|---|
| private void writeLiteral(int type, Name name, String prefix, String namespaceURI) throws IOException | |
An instance will be registered with the
StAXDocumentSerializer.
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final Collection | |
| pack-priv final Map |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public void |
| collectionOfContexts | back to summary |
|---|---|
| pack-priv final Collection<FastInfosetStreamWriterOutput. | |
| contexts | back to summary |
|---|---|
| pack-priv final Map<JAXBContext, FastInfosetStreamWriterOutput. | |
| AppData | back to summary |
|---|---|
| pack-priv AppData() | |
| clear | back to summary |
|---|---|
| public void clear() Implements org. Clear all the tables.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv final int[] | |
| pack-priv final int[] | |
| pack-priv final int[] | |
| pack-priv int | indexOffset
The offset of the index |
| pack-priv final int[] | |
| pack-priv int | maxIndex
The the maximum known value of an index |
| pack-priv boolean | requiresClear
True if the tables require clearing |
| Access | Constructor and Description |
|---|---|
| pack-priv | TablesPerJAXBContext(JAXBContextImpl
the JAXB context. context, int the initial index offset to calculate
the maximum possible index initialIndexOffset)Create a new set of tables for a JAXB context. |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| private void | |
| public void | clearOrResetTables(int
the initial index offset to calculate
the maximum possible index intialIndexOffset)Clear or reset the tables. |
| public void | |
| public void | |
| private void | |
| private void |
| attributeIndexes | back to summary |
|---|---|
| pack-priv final int[] attributeIndexes | |
| elementIndexes | back to summary |
|---|---|
| pack-priv final int[] elementIndexes | |
| elementIndexPrefixes | back to summary |
|---|---|
| pack-priv final int[] elementIndexPrefixes | |
| indexOffset | back to summary |
|---|---|
| pack-priv int indexOffset The offset of the index | |
| localNameIndexes | back to summary |
|---|---|
| pack-priv final int[] localNameIndexes | |
| maxIndex | back to summary |
|---|---|
| pack-priv int maxIndex The the maximum known value of an index | |
| requiresClear | back to summary |
|---|---|
| pack-priv boolean requiresClear True if the tables require clearing | |
| TablesPerJAXBContext | back to summary |
|---|---|
| pack-priv TablesPerJAXBContext(JAXBContextImpl context, int initialIndexOffset) Create a new set of tables for a JAXB context.
| |
| clear | back to summary |
|---|---|
| private void clear(int[] array) | |
| clearAll | back to summary |
|---|---|
| private void clearAll() | |
| clearOrResetTables | back to summary |
|---|---|
| public void clearOrResetTables(int intialIndexOffset) Clear or reset the tables.
| |
| incrementMaxIndexValue | back to summary |
|---|---|
| public void incrementMaxIndexValue() Increment the maximum know index value The indexes are preserved. | |
| requireClearTables | back to summary |
|---|---|
| public void requireClearTables() Require that tables are cleared. | |
| reset | back to summary |
|---|---|
| private void reset(int[] array) | |
| resetAll | back to summary |
|---|---|
| private void resetAll() | |