Class JsonStreamFactory
java.lang.Object
org.apache.synapse.commons.staxon.core.json.stream.JsonStreamFactory
- Direct Known Subclasses:
JsonStreamFactoryImpl
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 -
Method Summary
Modifier and TypeMethodDescriptionabstract JsonStreamSourceCreate stream source.abstract JsonStreamSourcecreateJsonStreamSource(InputStream input, Constants.SCANNER scanner) Create stream source.abstract JsonStreamSourcecreateJsonStreamSource(Reader reader) Create stream source.abstract JsonStreamSourcecreateJsonStreamSource(Reader reader, Constants.SCANNER scanner) Create stream source.abstract JsonStreamTargetcreateJsonStreamTarget(OutputStream output, boolean pretty) Create stream target.abstract JsonStreamTargetcreateJsonStreamTarget(Writer writer, boolean pretty) Create stream target.static JsonStreamFactoryCreate a new instance of a JsonStreamFactory.
-
Constructor Details
-
JsonStreamFactory
public JsonStreamFactory()
-
-
Method Details
-
newFactory
Create a new instance of a JsonStreamFactory.
Determines the class to instantiate as follows:
- 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.
- 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.
- 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.
- 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
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
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
-