|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjavax.json.Json
public class Json
Factory to create JsonParser, JsonGenerator,
JsonParserFactory and JsonGeneratorFactory instances.
All the methods would locate a provider instance, which is returned by
the provider method, and is used
to create JsonParser, JsonGenerator
JsonParserFactory and JsonGeneratorFactory instances.
For example, a JSON parser for parsing an empty array could be created as
follows:
StringReader reader = new StringReader("[]");
JsonParser parser = Json.createParser(reader);
All of the methods in this class are safe for use by multiple concurrent threads.
| Constructor Summary | |
|---|---|
Json()
|
|
| Method Summary | |
|---|---|
static JsonGenerator |
createGenerator(OutputStream out)
Creates a JSON generator which can be used to write JSON text to the specified byte stream. |
static JsonGenerator |
createGenerator(OutputStream out,
JsonConfiguration config)
Creates a JSON generator which can be used to write JSON text to the specified byte stream. |
static JsonGenerator |
createGenerator(OutputStream out,
String encoding)
Creates a JSON generator which can be used to write JSON text to the specified byte stream. |
static 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. |
static JsonGenerator |
createGenerator(Writer writer)
Creates a JSON generator which can be used to write JSON text to the specified character stream. |
static JsonGenerator |
createGenerator(Writer writer,
JsonConfiguration config)
Creates a JSON generator which can be used to write JSON text to the specified character stream. |
static JsonGeneratorFactory |
createGeneratorFactory()
Creates a generator factory which can be used to create JsonGenerator. |
static JsonGeneratorFactory |
createGeneratorFactory(JsonConfiguration config)
Creates a generator factory which can be used to create JsonGenerator. |
static JsonParser |
createParser(InputStream in)
Creates a JSON parser from the specified byte stream. |
static JsonParser |
createParser(InputStream in,
JsonConfiguration config)
Creates a JSON parser from the specified byte stream. |
static JsonParser |
createParser(InputStream in,
String encoding)
Creates a JSON parser from the specified byte stream. |
static JsonParser |
createParser(InputStream in,
String encoding,
JsonConfiguration config)
Creates a JSON parser from the specified byte stream. |
static JsonParser |
createParser(JsonArray array)
Creates a JSON parser from the specified JSON array. |
static JsonParser |
createParser(JsonArray array,
JsonConfiguration config)
Creates a JSON parser from the specified JSON array. |
static JsonParser |
createParser(JsonObject object)
Creates a JSON parser from the specified JSON object. |
static JsonParser |
createParser(JsonObject obj,
JsonConfiguration config)
Creates a JSON parser from the specified JSON object. |
static JsonParser |
createParser(Reader reader)
Creates a JSON parser from the specified character stream |
static JsonParser |
createParser(Reader reader,
JsonConfiguration config)
Creates a JSON parser from the specified character stream. |
static JsonParserFactory |
createParserFactory()
Creates a parser factory which can be used to create JsonParser. |
static JsonParserFactory |
createParserFactory(JsonConfiguration config)
Creates a parser factory which can be used to create JsonParser. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Json()
| Method Detail |
|---|
public static JsonParser createParser(Reader reader)
reader - i/o reader from which JSON is to be read
public static JsonParser createParser(Reader reader,
JsonConfiguration config)
reader - i/o reader from which JSON is to be readconfig - configuration of the parser
IllegalArgumentException - if a feature in the configuration
is not knownpublic static JsonParser createParser(InputStream in)
in - i/o stream from which JSON is to be read
JsonException - if encoding cannot be determined
or i/o error
public static JsonParser createParser(InputStream in,
String encoding)
in - i/o stream from which JSON is to be readencoding - the name of character
encoding of the stream.
JsonException - if the named encoding is not supported. The
cause of the exception would be
UnsupportedEncodingExceptionCharset
public static JsonParser createParser(InputStream in,
JsonConfiguration config)
in - i/o stream from which JSON is to be readconfig - configuration of the parser
IllegalArgumentException - if a feature in the configuration
is not known
public static JsonParser createParser(InputStream in,
String encoding,
JsonConfiguration config)
in - i/o stream from which JSON is to be readencoding - the name of character
encoding of the stream.config - configuration of the parser
JsonException - if the named encoding is not supported. The
cause of the exception would be
UnsupportedEncodingException
IllegalArgumentException - if a feature in the configuration
is not knownCharsetpublic static JsonParser createParser(JsonObject object)
object - JSON object
public static JsonParser createParser(JsonObject obj,
JsonConfiguration config)
obj - JSON objectconfig - configuration of the parser
IllegalArgumentException - if a feature in the configuration
is not knownpublic static JsonParser createParser(JsonArray array)
array - JSON array
public static JsonParser createParser(JsonArray array,
JsonConfiguration config)
array - JSON arrayconfig - configuration of the parser
IllegalArgumentException - if a feature in the configuration
is not knownpublic static JsonGenerator createGenerator(Writer writer)
writer - a i/o writer to which JSON is written
public static JsonGenerator createGenerator(Writer writer,
JsonConfiguration config)
writer - i/o writer to which JSON is writtenconfig - configuration of the generator
IllegalArgumentException - if a feature in the configuration
is not knownpublic static JsonGenerator createGenerator(OutputStream out)
out - i/o stream to which JSON is written
public static JsonGenerator createGenerator(OutputStream out,
JsonConfiguration config)
out - i/o stream to which JSON is writtenconfig - configuration of the generator
IllegalArgumentException - if a feature in the configuration
is not known
public static JsonGenerator createGenerator(OutputStream out,
String encoding)
out - i/o stream to which JSON is writtenencoding - the name of character
encoding of the stream.
JsonException - if the named encoding is not supported. The
cause of the exception would be
UnsupportedEncodingExceptionCharset
public static JsonGenerator createGenerator(OutputStream out,
String encoding,
JsonConfiguration config)
out - i/o stream to which JSON is writtenencoding - the name of character
encoding of the stream.config - configuration of the generator
JsonException - if the named encoding is not supported. The
cause of the exception would be
UnsupportedEncodingException
IllegalArgumentException - if a feature in the configuration
is not knownCharsetpublic static JsonParserFactory createParserFactory()
JsonParser.
public static JsonParserFactory createParserFactory(JsonConfiguration config)
JsonParser.
The created parser factory is configured with the specified
configuration
config - configuration of the parser factory
IllegalArgumentException - if a feature in the configuration
is not knownpublic static JsonGeneratorFactory createGeneratorFactory()
JsonGenerator.
public static JsonGeneratorFactory createGeneratorFactory(JsonConfiguration config)
JsonGenerator.
The created generator factory is configured with the specified
configuration.
config - configuration of the generator factory
IllegalArgumentException - if a feature in the configuration
is not known
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||