Top Description Methods
org.jvnet.fastinfoset.stax

public Interface LowLevelFastInfosetStreamWriter

Known Direct Implementers
com.sun.xml.fastinfoset.stax.StAXDocumentSerializer
Imports
java.io.IOException, javax.xml.stream.XMLStreamException, org.xml.sax.helpers.DefaultHandler

Low level Fast Infoset stream writer.

This interface provides additional stream-based serialization methods for the case where an application is in specific control of the serialization process and has the knowledge to call the LowLevel methods in the required order.

For example, the application may be able to perform efficient information to indexing mapping and to provide certain information in UTF-8 encoded form.

These methods may be used in conjunction with javax.xml.stream.XMLStreamWriter as long as an element fragment written using the efficient streaming methods are self-contained and no sub-fragment is written using methods from javax.xml.stream.XMLStreamWriter.

The required call sequence is as follows:

CALLSEQUENCE    := startDocument
                   initiateLowLevelWriting ELEMENT
                   endDocument
                |  initiateLowLevelWriting ELEMENT   // for fragment

ELEMENT         := writeLowLevelTerminationAndMark
                   NAMESPACES?
                   ELEMENT_NAME
                   ATTRIBUTES?
                   writeLowLevelEndStartElement
                   CONTENTS
                   writeLowLevelEndElement

NAMESPACES      := writeLowLevelStartNamespaces
                   writeLowLevelNamespace*
                   writeLowLevelEndNamespaces

ELEMENT_NAME    := writeLowLevelStartElementIndexed
                |  writeLowLevelStartNameLiteral
                |  writeLowLevelStartElement

ATTRUBUTES      := writeLowLevelStartAttributes
                  (ATTRIBUTE_NAME writeLowLevelAttributeValue)*

ATTRIBUTE_NAME  := writeLowLevelAttributeIndexed
                |  writeLowLevelStartNameLiteral
                |  writeLowLevelAttribute


CONTENTS      := (ELEMENT | writeLowLevelText writeLowLevelOctets)*

Some methods defer to the application for the mapping of information to indexes.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the index.
getLocalNameIndex
()

Get the current index that was applied to an [local name] of an Element or Attribute Information Item.

public int

Returns:

the index.
getNextAttributeIndex
()

Get the next index to apply to an Attribute Information Item.

public int

Returns:

the index.
getNextElementIndex
()

Get the next index to apply to an Element Information Item.

public int

Returns:

the index.
getNextLocalNameIndex
()

Get the next index to apply to an [local name] of an Element or Attribute Information Item.

public void
initiateLowLevelWriting()

Initiate low level writing of an element fragment.

public boolean

Returns:

true if attribute is indexed, otherwise false.
writeLowLevelAttribute
(String prefix, String namespaceURI, String localName)

Write an attribute.

public void
public void
public void
public void
public void
public void
writeLowLevelNamespace(String prefix, String namespaceName)

public void
writeLowLevelOctets(byte[] octets, int length)

public void
public boolean

Returns:

true if element is indexed, otherwise false.
writeLowLevelStartElement
(int type, String prefix, String localName, String namespaceURI)

Write the start of an element.

public void
writeLowLevelStartElementIndexed(int type, int index)

public void
writeLowLevelStartNameLiteral(int type, String prefix, byte[] utf8LocalName, String namespaceURI)

public void
writeLowLevelStartNameLiteral(int type, String prefix, int localNameIndex, String namespaceURI)

public void
public void
public void
writeLowLevelText(char[] text, int length)

public void

Method Detail

getLocalNameIndexback to summary
public int getLocalNameIndex()

Get the current index that was applied to an [local name] of an Element or Attribute Information Item.

Returns:int

the index.

getNextAttributeIndexback to summary
public int getNextAttributeIndex()

Get the next index to apply to an Attribute Information Item. This will increment the next obtained index such that:

i = w.getNextAttributeIndex();
j = w.getNextAttributeIndex();
i == j + 1;
Returns:int

the index.

getNextElementIndexback to summary
public int getNextElementIndex()

Get the next index to apply to an Element Information Item.

This will increment the next obtained index such that:

i = w.getNextElementIndex();
j = w.getNextElementIndex();
i == j + 1;
Returns:int

the index.

getNextLocalNameIndexback to summary
public int getNextLocalNameIndex()

Get the next index to apply to an [local name] of an Element or Attribute Information Item. This will increment the next obtained index such that:

i = w.getNextLocalNameIndex();
j = w.getNextLocalNameIndex();
i == j + 1;
Returns:int

the index.

initiateLowLevelWritingback to summary
public void initiateLowLevelWriting() throws XMLStreamException

Initiate low level writing of an element fragment.

This method must be invoked before other low level method.

writeLowLevelAttributeback to summary
public boolean writeLowLevelAttribute(String prefix, String namespaceURI, String localName) throws IOException

Write an attribute.

Returns:boolean

true if attribute is indexed, otherwise false.

writeLowLevelAttributeIndexedback to summary
public void writeLowLevelAttributeIndexed(int index) throws IOException
writeLowLevelAttributeValueback to summary
public void writeLowLevelAttributeValue(String value) throws IOException
writeLowLevelEndElementback to summary
public void writeLowLevelEndElement() throws IOException
writeLowLevelEndNamespacesback to summary
public void writeLowLevelEndNamespaces() throws IOException
writeLowLevelEndStartElementback to summary
public void writeLowLevelEndStartElement() throws IOException
writeLowLevelNamespaceback to summary
public void writeLowLevelNamespace(String prefix, String namespaceName) throws IOException
writeLowLevelOctetsback to summary
public void writeLowLevelOctets(byte[] octets, int length) throws IOException
writeLowLevelStartAttributesback to summary
public void writeLowLevelStartAttributes() throws IOException
writeLowLevelStartElementback to summary
public boolean writeLowLevelStartElement(int type, String prefix, String localName, String namespaceURI) throws IOException

Write the start of an element.

Returns:boolean

true if element is indexed, otherwise false.

writeLowLevelStartElementIndexedback to summary
public void writeLowLevelStartElementIndexed(int type, int index) throws IOException
writeLowLevelStartNameLiteralback to summary
public void writeLowLevelStartNameLiteral(int type, String prefix, byte[] utf8LocalName, String namespaceURI) throws IOException
writeLowLevelStartNameLiteralback to summary
public void writeLowLevelStartNameLiteral(int type, String prefix, int localNameIndex, String namespaceURI) throws IOException
writeLowLevelStartNamespacesback to summary
public void writeLowLevelStartNamespaces() throws IOException
writeLowLevelTerminationAndMarkback to summary
public void writeLowLevelTerminationAndMark() throws IOException
writeLowLevelTextback to summary
public void writeLowLevelText(char[] text, int length) throws IOException
writeLowLevelTextback to summary
public void writeLowLevelText(String text) throws IOException