Class Stax2Result

  • All Implemented Interfaces:
    javax.xml.transform.Result
    Direct Known Subclasses:
    Stax2BlockResult, Stax2ReferentialResult

    public abstract class Stax2Result
    extends java.lang.Object
    implements javax.xml.transform.Result
    This is the base class for additional output results (implementations of Result) that Stax2 XMLInputFactory2 implementations should support.

    Note about usage by the parser factory implementations: the expectation is that at least one of methods constructWriter() and constructOutputStream() will succeed, but not necessarily both. This generally depends on type of resource being represented: for example, if the source is a StringBuffer, it is most naturally represent via Writer. For File-backed results, on the other hand, an OutputStream is the most natural access method.

    Other things to note about using result Writers and OutputStreams:

    • Caller is responsible for closing any Writer and OutputStream instances requested. That is, caller owns these accessor objects.
    • Result objects are only required to return a non-null object once: after this, if new non-null instances are returned, they must not be the same objects as returned earlier. Implementations can choose to construct new instances to the same backing data structure or resource; if so, they should document this behavior.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected java.lang.String mEncoding  
      protected java.lang.String mPublicId  
      protected java.lang.String mSystemId  
      • Fields inherited from interface javax.xml.transform.Result

        PI_DISABLE_OUTPUT_ESCAPING, PI_ENABLE_OUTPUT_ESCAPING
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected Stax2Result()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract java.io.OutputStream constructOutputStream()
      This method creates an OutputStream via which underlying output target can be written to.
      abstract java.io.Writer constructWriter()
      This method creates a Writer via which underlying output target can be written to.
      java.lang.String getEncoding()  
      java.lang.String getPublicId()  
      java.lang.String getSystemId()  
      void setEncoding​(java.lang.String enc)  
      void setPublicId​(java.lang.String id)  
      void setSystemId​(java.lang.String id)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mSystemId

        protected java.lang.String mSystemId
      • mPublicId

        protected java.lang.String mPublicId
      • mEncoding

        protected java.lang.String mEncoding
    • Constructor Detail

      • Stax2Result

        protected Stax2Result()
    • Method Detail

      • getSystemId

        public java.lang.String getSystemId()
        Specified by:
        getSystemId in interface javax.xml.transform.Result
      • setSystemId

        public void setSystemId​(java.lang.String id)
        Specified by:
        setSystemId in interface javax.xml.transform.Result
      • getPublicId

        public java.lang.String getPublicId()
      • setPublicId

        public void setPublicId​(java.lang.String id)
      • getEncoding

        public java.lang.String getEncoding()
      • setEncoding

        public void setEncoding​(java.lang.String enc)
      • constructWriter

        public abstract java.io.Writer constructWriter()
                                                throws java.io.IOException
        This method creates a Writer via which underlying output target can be written to. Note that caller is responsible for closing that Writer when it is done reading it.
        Throws:
        java.io.IOException
      • constructOutputStream

        public abstract java.io.OutputStream constructOutputStream()
                                                            throws java.io.IOException
        This method creates an OutputStream via which underlying output target can be written to. Note that caller is responsible for closing that OutputStream when it is done reading it
        Throws:
        java.io.IOException