Class JsonStreamFactory

    • Constructor Detail

      • JsonStreamFactory

        public JsonStreamFactory()
    • Method Detail

      • newFactory

        public static JsonStreamFactory newFactory()
                                            throws FactoryConfigurationError

        Create a new instance of a JsonStreamFactory.

        Determines the class to instantiate as follows:

        1. Use the Services API (as detailed in the JAR specification). If a resource with the name of META-INF/services/de.odysseus.staxon.json.stream.JsonStreamFactory exists, then its first line, if present, is used as the UTF-8 encoded name of the implementation class.
        2. Use the properties file "lib/staxon.properties" in the JRE directory. If this file exists and is readable by the java.util.Properties.load(InputStream) method, and it contains an entry whose key is "de.odysseus.staxon.json.stream.JsonStreamFactory", then the value of that entry is used as the name of the implementation class.
        3. Use the de.odysseus.staxon.json.stream.JsonStreamFactory system property. If a system property with this name is defined, then its value is used as the name of the implementation class.
        4. Use platform default: "de.odysseus.staxon.json.stream.impl.JsonStreamFactoryImpl".

        Returns:
        An instance of JsonStreamFactory.
        Throws:
        FactoryConfigurationError - if a factory class cannot be found or instantiation fails.
      • createJsonStreamTarget

        public abstract JsonStreamTarget createJsonStreamTarget​(Writer writer,
                                                                boolean pretty)
                                                         throws IOException
        Create stream target.
        Parameters:
        writer -
        pretty -
        Returns:
        stream target
        Throws:
        IOException