- java.lang.Object
-
- javax.json.spi.JsonProvider
-
public abstract class JsonProvider extends Object
Service provider for JSON processing objects.All the methods in this class are safe for use by multiple concurrent threads.
- Author:
- Jitendra Kotamraju
- See Also:
ServiceLoader
-
-
Constructor Summary
Constructors Modifier Constructor and Description protected
JsonProvider()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description abstract JsonArrayBuilder
createArrayBuilder()
Creates a JSON array builderabstract JsonBuilderFactory
createBuilderFactory(Map<String,?> config)
Creates a builder factory for creatingJsonArrayBuilder
andJsonObjectBuilder
objects.abstract JsonGenerator
createGenerator(OutputStream out)
Creates a JSON generator for writing JSON text to a byte stream.abstract JsonGenerator
createGenerator(Writer writer)
Creates a JSON generator for writing JSON text to a character stream.abstract JsonGeneratorFactory
createGeneratorFactory(Map<String,?> config)
Creates a generator factory for creatingJsonGenerator
instances.abstract JsonObjectBuilder
createObjectBuilder()
Creates a JSON object builderabstract JsonParser
createParser(InputStream in)
Creates a JSON parser from the specified byte stream.abstract JsonParser
createParser(Reader reader)
Creates a JSON parser from a character stream.abstract JsonParserFactory
createParserFactory(Map<String,?> config)
Creates a parser factory for creatingJsonParser
instances.abstract JsonReader
createReader(InputStream in)
Creates a JSON reader from a byte stream.abstract JsonReader
createReader(Reader reader)
Creates a JSON reader from a character stream.abstract JsonReaderFactory
createReaderFactory(Map<String,?> config)
Creates a reader factory for creatingJsonReader
objects.abstract JsonWriter
createWriter(OutputStream out)
abstract JsonWriter
createWriter(Writer writer)
abstract JsonWriterFactory
createWriterFactory(Map<String,?> config)
Creates a writer factory for creatingJsonWriter
objects.static JsonProvider
provider()
Creates a JSON provider object.
-
-
-
Method Detail
-
provider
public static JsonProvider 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:
ServiceLoader
-
createParser
public abstract JsonParser createParser(Reader reader)
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
public abstract JsonParser createParser(InputStream in)
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
public abstract JsonParserFactory createParserFactory(Map<String,?> config)
Creates a parser factory for creatingJsonParser
instances. 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
public abstract JsonGenerator createGenerator(Writer writer)
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
public abstract JsonGenerator createGenerator(OutputStream out)
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
public abstract JsonGeneratorFactory createGeneratorFactory(Map<String,?> config)
Creates a generator factory for creatingJsonGenerator
instances. 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
public abstract JsonReader createReader(Reader reader)
Creates a JSON reader from a character stream.- Parameters:
reader
- a reader from which JSON is to be read- Returns:
- a JSON reader
-
createReader
public abstract JsonReader createReader(InputStream in)
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
public abstract JsonWriter createWriter(Writer writer)
- Parameters:
writer
- to which JSON object or array is written- Returns:
- a JSON writer
-
createWriter
public abstract JsonWriter createWriter(OutputStream out)
Creates a JSON writer to write a JSONobject
orarray
structure 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
public abstract JsonWriterFactory createWriterFactory(Map<String,?> config)
Creates a writer factory for creatingJsonWriter
objects. 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
public abstract JsonReaderFactory createReaderFactory(Map<String,?> config)
Creates a reader factory for creatingJsonReader
objects. 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
public abstract JsonObjectBuilder createObjectBuilder()
Creates a JSON object builder- Returns:
- a JSON object builder
-
createArrayBuilder
public abstract JsonArrayBuilder createArrayBuilder()
Creates a JSON array builder- Returns:
- a JSON array builder
-
createBuilderFactory
public abstract JsonBuilderFactory createBuilderFactory(Map<String,?> config)
Creates a builder factory for creatingJsonArrayBuilder
andJsonObjectBuilder
objects. 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
-
-
Nederlandse vertaling
U hebt gevraagd om deze site in het Nederlands te bezoeken. Voor nu wordt alleen de interface vertaald, maar nog niet alle inhoud.Als je me wilt helpen met vertalingen, is je bijdrage welkom. Het enige dat u hoeft te doen, is u op de site registreren en mij een bericht sturen waarin u wordt gevraagd om u toe te voegen aan de groep vertalers, zodat u de gewenste pagina's kunt vertalen. Een link onderaan elke vertaalde pagina geeft aan dat u de vertaler bent en heeft een link naar uw profiel.
Bij voorbaat dank.
Document heeft de 11/06/2005 gemaakt, de laatste keer de 18/08/2025 gewijzigd
Bron van het afgedrukte document:https://www.gaudry.be/nl/java-api-javaee-rf-javax/json/spi/jsonprovider.html
De infobrol is een persoonlijke site waarvan de inhoud uitsluitend mijn verantwoordelijkheid is. De tekst is beschikbaar onder CreativeCommons-licentie (BY-NC-SA). Meer info op de gebruiksvoorwaarden en de auteur.
Referenties
Deze verwijzingen en links verwijzen naar documenten die geraadpleegd zijn tijdens het schrijven van deze pagina, of die aanvullende informatie kunnen geven, maar de auteurs van deze bronnen kunnen niet verantwoordelijk worden gehouden voor de inhoud van deze pagina.
De auteur van deze site is als enige verantwoordelijk voor de manier waarop de verschillende concepten, en de vrijheden die met de referentiewerken worden genomen, hier worden gepresenteerd. Vergeet niet dat u meerdere broninformatie moet doorgeven om het risico op fouten te verkleinen.