Class XMLStreamBuffer

  • Direct Known Subclasses:
    MutableXMLStreamBuffer, XMLStreamBufferMark

    public abstract class XMLStreamBuffer
    extends Object
    An immutable stream-based buffer of an XML infoset.

    A XMLStreamBuffer is an abstract class. It is immutable with respect to the methods on the class, which are non-modifying in terms of state.

    A XMLStreamBuffer can be processed using specific SAX and StAX-based processors. Utility methods on XMLStreamBuffer are provided for such functionality that utilize SAX and StAX-based processors. The same instance of a XMLStreamBuffer may be processed multiple times and concurrently by more than one processor.

    There are two concrete implementations of XMLStreamBuffer. The first, MutableXMLStreamBuffer, can be instantiated for the creation of a buffer using SAX and StAX-based creators, and from which may be processed as an XMLStreamBuffer. The second, XMLStreamBufferMark, can be instantiated to mark into an existing buffer that is being created or processed. This allows a subtree of XMLStreamBuffer to be treated as its own XMLStreamBuffer.

    A XMLStreamBuffer can represent a complete XML infoset or a subtree of an XML infoset. It is also capable of representing a "forest", where the buffer represents multiple adjacent XML elements, although in this mode there are restrictions about how you can consume such forest, because not all XML APIs handle forests very well.

    • Field Detail

      • _inscopeNamespaces

        protected Map<String,​String> _inscopeNamespaces
        In scope namespaces on a fragment
      • _hasInternedStrings

        protected boolean _hasInternedStrings
        True if the buffer was created from a parser that interns Strings as specified by the SAX interning features
      • _structure

        protected FragmentedArray<byte[]> _structure
        Fragmented array to hold structural information
      • _structurePtr

        protected int _structurePtr
      • _structureStrings

        protected FragmentedArray<String[]> _structureStrings
        Fragmented array to hold structural information as strings
      • _structureStringsPtr

        protected int _structureStringsPtr
      • _contentCharactersBuffer

        protected FragmentedArray<char[]> _contentCharactersBuffer
        Fragmented array to hold content information in a shared char[]
      • _contentCharactersBufferPtr

        protected int _contentCharactersBufferPtr
      • _contentObjects

        protected FragmentedArray<Object[]> _contentObjects
        Fragmented array to hold content information as objects
      • _contentObjectsPtr

        protected int _contentObjectsPtr
      • treeCount

        protected int treeCount
        Number of trees in this stream buffer.

        1 if there's only one, which is the normal case. When the buffer holds a forest, this value is greater than 1. If the buffer is empty, then 0.

        Notice that we cannot infer this value by looking at the FragmentedArrays, because this XMLStreamBuffer maybe a view of a portion of another bigger XMLStreamBuffer.

      • systemId

        protected String systemId
        The system identifier associated with the buffer
    • Constructor Detail

      • XMLStreamBuffer

        protected XMLStreamBuffer()