Class GsonFactory
java.lang.Object
com.google.api.client.json.JsonFactory
com.google.api.client.json.gson.GsonFactory
Low-level JSON library implementation based on GSON.
Implementation is thread-safe, and sub-classes must be thread-safe. For maximum efficiency, applications should use a single globally-shared instance of the JSON factory.
- Since:
- 1.3
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classBuilder for GsonFactory.(package private) static classHolder for the result ofgetDefaultInstance(). -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanControls the behavior of leniency in reading JSON value -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic GsonFactory.Builderbuilder()Returns the builder *createJsonGenerator(OutputStream out, Charset enc) Returns a new instance of a low-level JSON serializer for the given output stream and encoding.createJsonGenerator(Writer writer) Returns a new instance of a low-level JSON serializer for the given writer.Returns a new instance of a low-level JSON parser for the given input stream.createJsonParser(InputStream in, Charset charset) Returns a new instance of a low-level JSON parser for the given input stream.createJsonParser(Reader reader) Returns a new instance of a low-level JSON parser for the given reader.createJsonParser(String value) Returns a new instance of a low-level JSON parser for the given string value.static GsonFactoryBeta
Returns a global thread-safe instance.(package private) booleanReturns true if it is lenient to input JSON value.Methods inherited from class JsonFactory
createJsonObjectParser, fromInputStream, fromInputStream, fromReader, fromString, toByteArray, toPrettyString, toString
-
Field Details
-
readLeniency
private boolean readLeniencyControls the behavior of leniency in reading JSON value
-
-
Constructor Details
-
GsonFactory
public GsonFactory() -
GsonFactory
-
-
Method Details
-
getDefaultInstance
Beta
Returns a global thread-safe instance.- Since:
- 1.16
-
createJsonParser
Description copied from class:JsonFactoryReturns a new instance of a low-level JSON parser for the given input stream. The parser tries to detect the charset of the input stream by itself.- Specified by:
createJsonParserin classJsonFactory- Parameters:
in- input stream- Returns:
- new instance of a low-level JSON parser
-
createJsonParser
Description copied from class:JsonFactoryReturns a new instance of a low-level JSON parser for the given input stream.- Specified by:
createJsonParserin classJsonFactory- Parameters:
in- input streamcharset- charset in which the input stream is encoded ornullto let the parser detect the charset- Returns:
- new instance of a low-level JSON parser
-
createJsonParser
Description copied from class:JsonFactoryReturns a new instance of a low-level JSON parser for the given string value.- Specified by:
createJsonParserin classJsonFactory- Parameters:
value- string value- Returns:
- new instance of a low-level JSON parser
-
createJsonParser
Description copied from class:JsonFactoryReturns a new instance of a low-level JSON parser for the given reader.- Specified by:
createJsonParserin classJsonFactory- Parameters:
reader- reader- Returns:
- new instance of a low-level JSON parser
-
createJsonGenerator
Description copied from class:JsonFactoryReturns a new instance of a low-level JSON serializer for the given output stream and encoding.- Specified by:
createJsonGeneratorin classJsonFactory- Parameters:
out- output streamenc- encoding- Returns:
- new instance of a low-level JSON serializer
-
createJsonGenerator
Description copied from class:JsonFactoryReturns a new instance of a low-level JSON serializer for the given writer.- Specified by:
createJsonGeneratorin classJsonFactory- Parameters:
writer- writer- Returns:
- new instance of a low-level JSON serializer
-
getReadLeniency
boolean getReadLeniency()Returns true if it is lenient to input JSON value. -
builder
Returns the builder *
-