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 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(InputStream input)` Create stream source.
    `abstract JsonStreamSource` | `createJsonStreamSource(InputStream input, Constants.SCANNER scanner)` Create stream source.
    `abstract JsonStreamSource` | `createJsonStreamSource(Reader reader)` Create stream source.
    `abstract JsonStreamSource` | `createJsonStreamSource(Reader reader, Constants.SCANNER scanner)` Create stream source.
    `abstract JsonStreamTarget` | `createJsonStreamTarget(OutputStream output, boolean pretty)` Create stream target.
    `abstract JsonStreamTarget` | `createJsonStreamTarget(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 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.

    - #### createJsonStreamSource

          public abstract JsonStreamSource createJsonStreamSource(InputStream input)
                                                           throws IOException

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

    - #### createJsonStreamSource

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

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

    - #### createJsonStreamSource

          public abstract JsonStreamSource createJsonStreamSource(Reader reader)
                                                           throws IOException

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

    - #### createJsonStreamSource

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

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

    - #### createJsonStreamTarget

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

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

    - #### createJsonStreamTarget

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

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

Copyright © 2005–2019 Apache Software Foundation. All rights reserved.