Package javax.json.spi
Class JsonProvider
java.lang.Object
javax.json.spi.JsonProvider
Service provider for JSON processing objects.
All the methods in this class are safe for use by multiple concurrent threads.
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract JsonArrayBuilderCreates a JSON array builderabstract JsonBuilderFactorycreateBuilderFactory(Map<String, ?> config) Creates a builder factory for creatingJsonArrayBuilderandJsonObjectBuilderobjects.abstract JsonGeneratorCreates a JSON generator for writing JSON text to a byte stream.abstract JsonGeneratorcreateGenerator(Writer writer) Creates a JSON generator for writing JSON text to a character stream.abstract JsonGeneratorFactorycreateGeneratorFactory(Map<String, ?> config) Creates a generator factory for creatingJsonGeneratorinstances.abstract JsonObjectBuilderCreates a JSON object builderabstract JsonParserCreates a JSON parser from the specified byte stream.abstract JsonParsercreateParser(Reader reader) Creates a JSON parser from a character stream.abstract JsonParserFactorycreateParserFactory(Map<String, ?> config) Creates a parser factory for creatingJsonParserinstances.abstract JsonReaderCreates a JSON reader from a byte stream.abstract JsonReadercreateReader(Reader reader) Creates a JSON reader from a character stream.abstract JsonReaderFactorycreateReaderFactory(Map<String, ?> config) Creates a reader factory for creatingJsonReaderobjects.abstract JsonWritercreateWriter(OutputStream out) abstract JsonWritercreateWriter(Writer writer) abstract JsonWriterFactorycreateWriterFactory(Map<String, ?> config) Creates a writer factory for creatingJsonWriterobjects.static JsonProviderprovider()Creates a JSON provider object.
-
Constructor Details
-
JsonProvider
protected JsonProvider()
-
-
Method Details
-
provider
Creates a JSON provider object. The provider is loaded using theServiceLoader.load(Class)method. If there are no available service providers, this method returns the default service provider.- Returns:
- a JSON provider
- See Also:
-
createParser
Creates a JSON parser from a character stream.- Parameters:
reader- i/o reader from which JSON is to be read- Returns:
- a JSON parser
-
createParser
Creates a JSON parser from the specified byte stream. The character encoding of the stream is determined as defined in RFC 4627 .- Parameters:
in- i/o stream from which JSON is to be read- Returns:
- a JSON parser
- Throws:
JsonException- if encoding cannot be determined or i/o error (IOException would be cause of JsonException)
-
createParserFactory
Creates a parser factory for creatingJsonParserinstances. The factory is configured with the specified map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.- Parameters:
config- a map of provider specific properties to configure the JSON parsers. The map may be empty or null- Returns:
- a JSON parser factory
-
createGenerator
Creates a JSON generator for writing JSON text to a character stream.- Parameters:
writer- a i/o writer to which JSON is written- Returns:
- a JSON generator
-
createGenerator
Creates a JSON generator for writing JSON text to a byte stream.- Parameters:
out- i/o stream to which JSON is written- Returns:
- a JSON generator
-
createGeneratorFactory
Creates a generator factory for creatingJsonGeneratorinstances. The factory is configured with the specified map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.- Parameters:
config- a map of provider specific properties to configure the JSON generators. The map may be empty or null- Returns:
- a JSON generator factory
-
createReader
Creates a JSON reader from a character stream.- Parameters:
reader- a reader from which JSON is to be read- Returns:
- a JSON reader
-
createReader
Creates a JSON reader from a byte stream. The character encoding of the stream is determined as described in RFC 4627.- Parameters:
in- a byte stream from which JSON is to be read- Returns:
- a JSON reader
-
createWriter
- Parameters:
writer- to which JSON object or array is written- Returns:
- a JSON writer
-
createWriter
Creates a JSON writer to write a JSONobjectorarraystructure to the specified byte stream. Characters written to the stream are encoded into bytes using UTF-8 encoding.- Parameters:
out- to which JSON object or array is written- Returns:
- a JSON writer
-
createWriterFactory
Creates a writer factory for creatingJsonWriterobjects. The factory is configured with the specified map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.- Parameters:
config- a map of provider specific properties to configure the JSON writers. The map may be empty or null- Returns:
- a JSON writer factory
-
createReaderFactory
Creates a reader factory for creatingJsonReaderobjects. The factory is configured with the specified map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.- Parameters:
config- a map of provider specific properties to configure the JSON readers. The map may be empty or null- Returns:
- a JSON reader factory
-
createObjectBuilder
Creates a JSON object builder- Returns:
- a JSON object builder
-
createArrayBuilder
Creates a JSON array builder- Returns:
- a JSON array builder
-
createBuilderFactory
Creates a builder factory for creatingJsonArrayBuilderandJsonObjectBuilderobjects. The factory is configured with the specified map of provider specific configuration properties. Provider implementations should ignore any unsupported configuration properties specified in the map.- Parameters:
config- a map of provider specific properties to configure the JSON builders. The map may be empty or null- Returns:
- a JSON builder factory
-