Class OutputFactory

java.lang.Object
org.apache.sis.util.Static
org.apache.sis.xml.OutputFactory

final class OutputFactory extends Static
Provides access to XMLOutputFactory methods as static methods working on a SIS-wide instance. This convenience is provided in a separated class in order to allow the JVM to instantiate the factory only when first needed, when initializing this class.
Since:
0.4
Version:
1.0
  • Field Details

    • FACTORY

      private static final XMLOutputFactory FACTORY
      The SIS-wide factory. This factory can be specified by the user, for example using the javax.xml.stream.XMLOutputFactory system property.
      Note: XMLOutputFactory has an newDefaultFactory() method which bypass user settings.
  • Constructor Details

    • OutputFactory

      private OutputFactory()
      Do not allow instantiation of this class.
  • Method Details

    • createXMLEventWriter

      public static XMLEventWriter createXMLEventWriter(OutputStream out, String encoding) throws XMLStreamException
      Creates a new writer for the given stream. It is caller's responsibility to close the given output stream after usage (it will not be done by XMLEventWriter.close()).
      Parameters:
      out - where to write to.
      encoding - the document encoding (usually "UTF-8").
      Returns:
      the writer.
      Throws:
      XMLStreamException - if the writer cannot be created.
    • createXMLEventWriter

      public static XMLEventWriter createXMLEventWriter(Writer out) throws XMLStreamException
      Creates a new writer for the given stream. It is caller's responsibility to close the given writer after usage (it will not be done by XMLEventWriter.close()).
      Parameters:
      out - where to write to.
      Returns:
      the writer.
      Throws:
      XMLStreamException - if the writer cannot be created.
    • createXMLEventWriter

      public static XMLEventWriter createXMLEventWriter(ContentHandler out) throws XMLStreamException
      Creates a new writer for the JAXP result. Note that this method is identified as optional in JSE javadoc.
      Parameters:
      out - where to write to.
      Returns:
      the writer.
      Throws:
      XMLStreamException - if the writer cannot be created.
    • createXMLEventWriter

      public static XMLEventWriter createXMLEventWriter(Node out) throws XMLStreamException
      Creates a new writer for the JAXP result. Note that this method is identified as optional in JSE javadoc.
      Parameters:
      out - where to write to.
      Returns:
      the writer.
      Throws:
      XMLStreamException - if the writer cannot be created.
    • createXMLEventWriter

      public static XMLEventWriter createXMLEventWriter(Result out) throws XMLStreamException
      Creates a new writer for the JAXP result. Note that this method is identified as optional in JSE javadoc.
      Parameters:
      out - where to write to.
      Returns:
      the writer.
      Throws:
      XMLStreamException - if the writer cannot be created.
    • createXMLEventWriter

      public static XMLEventWriter createXMLEventWriter(XMLStreamWriter out) throws XMLStreamException
      Creates a new writer for the JAXP result. Note that this method is identified as optional in JSE javadoc. It is caller's responsibility to close the given stream writer after usage (it will not be done by XMLEventWriter.close()).
      Parameters:
      out - where to write to.
      Returns:
      the writer.
      Throws:
      XMLStreamException - if the writer cannot be created.