Interface LowLevelFastInfosetStreamWriter

  • All Known Implementing Classes:
    StAXDocumentSerializer

    public interface LowLevelFastInfosetStreamWriter
    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 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 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 Detail

      • initiateLowLevelWriting

        void initiateLowLevelWriting()
                              throws javax.xml.stream.XMLStreamException
        Initiate low level writing of an element fragment.

        This method must be invoked before other low level method.

        Throws:
        javax.xml.stream.XMLStreamException
      • getNextElementIndex

        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:
        the index.
      • getNextAttributeIndex

        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:
        the index.
      • getLocalNameIndex

        int getLocalNameIndex()
        Get the current index that was applied to an [local name] of an Element or Attribute Information Item.
        Returns:
        the index.
      • getNextLocalNameIndex

        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:
        the index.
      • writeLowLevelTerminationAndMark

        void writeLowLevelTerminationAndMark()
                                      throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelStartElementIndexed

        void writeLowLevelStartElementIndexed​(int type,
                                              int index)
                                       throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelStartElement

        boolean writeLowLevelStartElement​(int type,
                                          java.lang.String prefix,
                                          java.lang.String localName,
                                          java.lang.String namespaceURI)
                                   throws java.io.IOException
        Write the start of an element.
        Returns:
        true if element is indexed, otherwise false.
        Throws:
        java.io.IOException
      • writeLowLevelStartNamespaces

        void writeLowLevelStartNamespaces()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelNamespace

        void writeLowLevelNamespace​(java.lang.String prefix,
                                    java.lang.String namespaceName)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelEndNamespaces

        void writeLowLevelEndNamespaces()
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelStartAttributes

        void writeLowLevelStartAttributes()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelAttributeIndexed

        void writeLowLevelAttributeIndexed​(int index)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelAttribute

        boolean writeLowLevelAttribute​(java.lang.String prefix,
                                       java.lang.String namespaceURI,
                                       java.lang.String localName)
                                throws java.io.IOException
        Write an attribute.
        Returns:
        true if attribute is indexed, otherwise false.
        Throws:
        java.io.IOException
      • writeLowLevelAttributeValue

        void writeLowLevelAttributeValue​(java.lang.String value)
                                  throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelStartNameLiteral

        void writeLowLevelStartNameLiteral​(int type,
                                           java.lang.String prefix,
                                           byte[] utf8LocalName,
                                           java.lang.String namespaceURI)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelStartNameLiteral

        void writeLowLevelStartNameLiteral​(int type,
                                           java.lang.String prefix,
                                           int localNameIndex,
                                           java.lang.String namespaceURI)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelEndStartElement

        void writeLowLevelEndStartElement()
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelEndElement

        void writeLowLevelEndElement()
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelText

        void writeLowLevelText​(char[] text,
                               int length)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelText

        void writeLowLevelText​(java.lang.String text)
                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeLowLevelOctets

        void writeLowLevelOctets​(byte[] octets,
                                 int length)
                          throws java.io.IOException
        Throws:
        java.io.IOException