javax.json.spi
Class JsonProvider

java.lang.Object
  extended by javax.json.spi.JsonProvider

public abstract class JsonProvider
extends Object

Service provider for JSON objects.

Author:
Jitendra Kotamraju
See Also:
ServiceLoader

Constructor Summary
protected JsonProvider()
           
 
Method Summary
abstract  JsonGenerator createGenerator(OutputStream out)
          Creates a JSON generator which can be used to write JSON text to the specified byte stream.
abstract  JsonGenerator createGenerator(OutputStream out, JsonConfiguration config)
          Creates a JSON generator which can be used to write JSON text to the specified byte stream.
abstract  JsonGenerator createGenerator(OutputStream out, String encoding)
          Creates a JSON generator which can be used to write JSON text to the specified byte stream.
abstract  JsonGenerator createGenerator(OutputStream out, String encoding, JsonConfiguration config)
          Creates a JSON generator which can be used to write JSON text to the specified byte stream.
abstract  JsonGenerator createGenerator(Writer writer)
          Creates a JSON generator which can be used to write JSON text to the specified character stream.
abstract  JsonGenerator createGenerator(Writer writer, JsonConfiguration config)
          Creates a JSON generator which can be used to write JSON text to the specified character stream.
abstract  JsonGeneratorFactory createGeneratorFactory()
          Creates a generator factory which can be used to create JsonGenerator.
abstract  JsonGeneratorFactory createGeneratorFactory(JsonConfiguration config)
          Creates a generator factory which can be used to create JsonGenerator.
abstract  JsonParser createParser(InputStream in)
          Creates a JSON parser from the specified byte stream.
abstract  JsonParser createParser(InputStream in, JsonConfiguration config)
          Creates a JSON parser from the specified byte stream.
abstract  JsonParser createParser(InputStream in, String encoding)
          Creates a JSON parser from the specified byte stream.
abstract  JsonParser createParser(InputStream in, String encoding, JsonConfiguration config)
          Creates a JSON parser from the specified byte stream.
abstract  JsonParser createParser(JsonArray array)
          Creates a JSON parser from the specified JSON array.
abstract  JsonParser createParser(JsonArray array, JsonConfiguration config)
          Creates a JSON parser from the specified JSON array.
abstract  JsonParser createParser(JsonObject object)
          Creates a JSON parser from the specified JSON object.
abstract  JsonParser createParser(JsonObject object, JsonConfiguration config)
          Creates a JSON parser from the specified JSON object.
abstract  JsonParser createParser(Reader reader)
          Creates a JSON parser from the specified character stream
abstract  JsonParser createParser(Reader reader, JsonConfiguration config)
          Creates a JSON parser from the specified character stream.
abstract  JsonParserFactory createParserFactory()
          Creates a parser factory which can be used to create JsonParser.
abstract  JsonParserFactory createParserFactory(JsonConfiguration config)
          Creates a parser factory which can be used to create JsonParser.
static JsonProvider provider()
          Creates a JSON provider object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonProvider

protected JsonProvider()
Method Detail

provider

public static JsonProvider provider()
Creates a JSON provider object. The provider is loaded using ServiceLoader.load(Class) method. If there is no available service provider is found, then the default service provider is loaded using the current thread's context class loader.

Returns:
a JSON provider
See Also:
ServiceLoader

createParser

public abstract JsonParser createParser(Reader reader)
Creates a JSON parser from the specified character stream

Parameters:
reader - i/o reader from which JSON is to be read

createParser

public abstract JsonParser createParser(Reader reader,
                                        JsonConfiguration config)
Creates a JSON parser from the specified character stream. The created parser is configured with the specified configuration.

Parameters:
reader - i/o reader from which JSON is to be read
config - configuration of the parser

createParser

public abstract JsonParser createParser(InputStream in)
Creates a JSON parser from the specified byte stream. The character encoding of the stream is determined as per the RFC.

Parameters:
in - i/o stream from which JSON is to be read
Throws:
JsonException - if encoding cannot be determined or i/o error

createParser

public abstract JsonParser createParser(InputStream in,
                                        String encoding)
Creates a JSON parser from the specified byte stream. The bytes of the stream are decoded to characters using the specified encoding.

Parameters:
in - i/o stream from which JSON is to be read
encoding - the character encoding of the stream
Throws:
JsonException - if encoding is not supported or i/o error

createParser

public abstract JsonParser createParser(InputStream in,
                                        JsonConfiguration config)
Creates a JSON parser from the specified byte stream. The created parser is configured with the specified configuration. The character encoding of the stream is determinedas per the RFC

Parameters:
in - i/o stream from which JSON is to be read
config - configuration of the parser

createParser

public abstract JsonParser createParser(InputStream in,
                                        String encoding,
                                        JsonConfiguration config)
Creates a JSON parser from the specified byte stream. The bytes of the stream are decoded to characters using the specified encoding. The created parser is configured with the specified configuration.

Parameters:
in - i/o stream from which JSON is to be read
encoding - the character encoding of the stream
config - configuration of the parser

createParser

public abstract JsonParser createParser(JsonArray array)
Creates a JSON parser from the specified JSON array.

Parameters:
array - JSON array

createParser

public abstract JsonParser createParser(JsonArray array,
                                        JsonConfiguration config)
Creates a JSON parser from the specified JSON array. The created parser is configured with the specified configuration.

Parameters:
array - JSON array
config - configuration of the parser

createParser

public abstract JsonParser createParser(JsonObject object)
Creates a JSON parser from the specified JSON object.

Parameters:
object - JSON object

createParser

public abstract JsonParser createParser(JsonObject object,
                                        JsonConfiguration config)
Creates a JSON parser from the specified JSON object. The created parser is configured with the specified configuration.

Parameters:
object - JSON object
config - configuration of the parser

createParserFactory

public abstract JsonParserFactory createParserFactory()
Creates a parser factory which can be used to create JsonParser.

Returns:
JSON parser factory

createParserFactory

public abstract JsonParserFactory createParserFactory(JsonConfiguration config)
Creates a parser factory which can be used to create JsonParser. The created parser factory is configured with the specified configuration

Parameters:
config - configuration of the parser factory
Returns:
JSON parser factory

createGenerator

public abstract JsonGenerator createGenerator(Writer writer)
Creates a JSON generator which can be used to write JSON text to the specified character stream.

Parameters:
writer - a i/o writer to which JSON is written

createGenerator

public abstract JsonGenerator createGenerator(Writer writer,
                                              JsonConfiguration config)
Creates a JSON generator which can be used to write JSON text to the specified character stream. The created generator is configured with the specified configuration.

Parameters:
writer - i/o writer to which JSON is written
config - configuration of the generator

createGenerator

public abstract JsonGenerator createGenerator(OutputStream out)
Creates a JSON generator which can be used to write JSON text to the specified byte stream.

Parameters:
out - i/o stream to which JSON is written

createGenerator

public abstract JsonGenerator createGenerator(OutputStream out,
                                              JsonConfiguration config)
Creates a JSON generator which can be used to write JSON text to the specified byte stream. Characters written to the stream are encoded into bytes using UTF-8 encoding. The created generator is configured with the specified configuration.

Parameters:
out - i/o stream to which JSON is written
config - configuration of the generator

createGenerator

public abstract JsonGenerator createGenerator(OutputStream out,
                                              String encoding)
Creates a JSON generator which can be used to write JSON text to the specified byte stream. Characters written to the stream are encoded into bytes using the specified encoding.

Parameters:
out - i/o stream to which JSON is written
encoding - the character encoding of the stream

createGenerator

public abstract JsonGenerator createGenerator(OutputStream out,
                                              String encoding,
                                              JsonConfiguration config)
Creates a JSON generator which can be used to write JSON text to the specified byte stream. Characters written to the stream are encoded into bytes using the specified encoding. The created generator is configured with the specified configuration.

Parameters:
out - i/o stream to which JSON is written
encoding - the character encoding of the stream
config - configuration of the generator

createGeneratorFactory

public abstract JsonGeneratorFactory createGeneratorFactory()
Creates a generator factory which can be used to create JsonGenerator.

Returns:
JSON generator factory

createGeneratorFactory

public abstract JsonGeneratorFactory createGeneratorFactory(JsonConfiguration config)
Creates a generator factory which can be used to create JsonGenerator. The created generator factory is configured with the specified configuration.

Parameters:
config - configuration of the generator factory
Returns:
JSON generator factory



Copyright © 2012 Oracle and/or its affiliates. All rights reserved.