org.apache.synapse.commons.staxon.core.json.stream

## Class JsonStreamFactory

- java.lang.Object
- - org.apache.synapse.commons.staxon.core.json.stream.JsonStreamFactory

- Direct Known Subclasses:
    JsonStreamFactoryImpl

      public abstract class JsonStreamFactory
      extends java.lang.Object

  Abstract JSON stream (`JsonStreamSource` and `JsonStreamTarget`) factory.

  This class provides the static `newFactory()` method to lookup and instantiate a default implementation using the Services API (as detailed in the JAR specification).

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `JsonStreamFactory()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract JsonStreamSource` | `createJsonStreamSource(java.io.InputStream input)` Create stream source.
    `abstract JsonStreamSource` | `createJsonStreamSource(java.io.InputStream input, Constants.SCANNER scanner)` Create stream source.
    `abstract JsonStreamSource` | `createJsonStreamSource(java.io.Reader reader)` Create stream source.
    `abstract JsonStreamSource` | `createJsonStreamSource(java.io.Reader reader, Constants.SCANNER scanner)` Create stream source.
    `abstract JsonStreamTarget` | `createJsonStreamTarget(java.io.OutputStream output, boolean pretty)` Create stream target.
    `abstract JsonStreamTarget` | `createJsonStreamTarget(java.io.Writer writer, boolean pretty)` Create stream target.
    `static JsonStreamFactory` | `newFactory()` Create a new instance of a JsonStreamFactory.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### JsonStreamFactory

          public JsonStreamFactory()

  - ### Method Detail

    - #### newFactory

          public static JsonStreamFactory newFactory()
                                              throws javax.xml.stream.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:
        `javax.xml.stream.FactoryConfigurationError` - if a factory class cannot be found or instantiation fails.

    - #### createJsonStreamSource

          public abstract JsonStreamSource createJsonStreamSource(java.io.InputStream input)
                                                           throws java.io.IOException

      Create stream source.
      Parameters:
        `input` -
      Returns:
        stream source
      Throws:
        `java.io.IOException`

    - #### createJsonStreamSource

          public abstract JsonStreamSource createJsonStreamSource(java.io.InputStream input,
                                                                  Constants.SCANNER scanner)
                                                           throws java.io.IOException

      Create stream source.
      Parameters:
        `input` -
        `scanner` - JSON Scanner to use
      Returns:
        stream source
      Throws:
        `java.io.IOException`

    - #### createJsonStreamSource

          public abstract JsonStreamSource createJsonStreamSource(java.io.Reader reader)
                                                           throws java.io.IOException

      Create stream source.
      Parameters:
        `reader` -
      Returns:
        stream source
      Throws:
        `java.io.IOException`

    - #### createJsonStreamSource

          public abstract JsonStreamSource createJsonStreamSource(java.io.Reader reader,
                                                                  Constants.SCANNER scanner)
                                                           throws java.io.IOException

      Create stream source.
      Parameters:
        `reader` -
        `scanner` - JSON Scanner to use
      Returns:
        stream source
      Throws:
        `java.io.IOException`

    - #### createJsonStreamTarget

          public abstract JsonStreamTarget createJsonStreamTarget(java.io.OutputStream output,
                                                                  boolean pretty)
                                                           throws java.io.IOException

      Create stream target.
      Parameters:
        `output` -
        `pretty` -
      Returns:
        stream target
      Throws:
        `java.io.IOException`

    - #### createJsonStreamTarget

          public abstract JsonStreamTarget createJsonStreamTarget(java.io.Writer writer,
                                                                  boolean pretty)
                                                           throws java.io.IOException

      Create stream target.
      Parameters:
        `writer` -
        `pretty` -
      Returns:
        stream target
      Throws:
        `java.io.IOException`

Copyright © 2005-2021 Apache Software Foundation. All Rights Reserved.