Class ExpandedStreamResult


  • public class ExpandedStreamResult
    extends java.lang.Object
    An ExpandedStreamResult is similar to a StreamResult, and is created from a StreamResult. It contains methods to construct a Writer from an OutputStream, and an OutputStream from a File or URI, and (unlike StreamResult) its getWriter() and getOutputStream() methods can therefore be used whether or not the writer and outputstream were explicitly set.
    • Constructor Summary

      Constructors 
      Constructor Description
      ExpandedStreamResult​(Configuration config, javax.xml.transform.stream.StreamResult result, java.util.Properties outputProperties)  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      CharacterSet getCharacterSet()
      Get the character set
      java.io.OutputStream getOutputStream()
      Get the output stream
      java.io.Writer getWriter()
      Get the output writer
      static java.io.File makeWritableOutputFile​(java.lang.String uriString)  
      protected java.io.OutputStream obtainOutputStream()  
      java.io.Writer obtainWriter()
      Make a Writer for this Emitter to use, given a StreamResult.
      void setWriter​(java.io.Writer writer)
      Set the output destination as a character stream
      boolean usesWriter()
      Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output.
      • Methods inherited from class java.lang.Object

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

      • ExpandedStreamResult

        public ExpandedStreamResult​(Configuration config,
                                    javax.xml.transform.stream.StreamResult result,
                                    java.util.Properties outputProperties)
                             throws XPathException
        Throws:
        XPathException
    • Method Detail

      • obtainWriter

        public java.io.Writer obtainWriter()
                                    throws XPathException
        Make a Writer for this Emitter to use, given a StreamResult.
        Throws:
        XPathException - if an error occurs
      • makeWritableOutputFile

        public static java.io.File makeWritableOutputFile​(java.lang.String uriString)
                                                   throws java.net.URISyntaxException,
                                                          XPathException
        Throws:
        java.net.URISyntaxException
        XPathException
      • usesWriter

        public boolean usesWriter()
        Determine whether the Emitter wants a Writer for character output or an OutputStream for binary output. The standard Emitters all use a Writer, so this returns true; but a subclass can override this if it wants to use an OutputStream
        Returns:
        true if a Writer is needed, as distinct from an OutputStream
      • setWriter

        public void setWriter​(java.io.Writer writer)
                       throws XPathException
        Set the output destination as a character stream
        Parameters:
        writer - the Writer to use as an output destination
        Throws:
        XPathException - if an error occurs
      • getWriter

        public java.io.Writer getWriter()
        Get the output writer
        Returns:
        the Writer being used as an output destination, if any
      • getOutputStream

        public java.io.OutputStream getOutputStream()
        Get the output stream
        Returns:
        the OutputStream being used as an output destination, if any
      • getCharacterSet

        public CharacterSet getCharacterSet()
        Get the character set