Class JacksonFactory
- java.lang.Object
-
- com.google.api.client.json.JsonFactory
-
- com.google.api.client.json.jackson2.JacksonFactory
-
public final class JacksonFactory extends JsonFactory
Low-level JSON library implementation based on Jackson 2.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.11
- Author:
- Yaniv Inbar
-
-
Constructor Summary
Constructors Constructor Description JacksonFactory()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description JsonGeneratorcreateJsonGenerator(OutputStream out, Charset enc)Returns a new instance of a low-level JSON serializer for the given output stream and encoding.JsonGeneratorcreateJsonGenerator(Writer writer)Returns a new instance of a low-level JSON serializer for the given writer.JsonParsercreateJsonParser(InputStream in)Returns a new instance of a low-level JSON parser for the given input stream.JsonParsercreateJsonParser(InputStream in, Charset charset)Returns a new instance of a low-level JSON parser for the given input stream.JsonParsercreateJsonParser(Reader reader)Returns a new instance of a low-level JSON parser for the given reader.JsonParsercreateJsonParser(String value)Returns a new instance of a low-level JSON parser for the given string value.static JacksonFactorygetDefaultInstance()Returns a global thread-safe instance.-
Methods inherited from class com.google.api.client.json.JsonFactory
createJsonObjectParser, fromInputStream, fromInputStream, fromReader, fromString, toByteArray, toPrettyString, toString
-
-
-
-
Method Detail
-
getDefaultInstance
public static JacksonFactory getDefaultInstance()
Returns a global thread-safe instance.- Since:
- 1.16
-
createJsonGenerator
public JsonGenerator createJsonGenerator(OutputStream out, Charset enc) throws IOException
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
- Throws:
IOException
-
createJsonGenerator
public JsonGenerator createJsonGenerator(Writer writer) throws IOException
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
- Throws:
IOException
-
createJsonParser
public JsonParser createJsonParser(Reader reader) throws IOException
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
- Throws:
IOException
-
createJsonParser
public JsonParser createJsonParser(InputStream in) throws IOException
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
- Throws:
IOException
-
createJsonParser
public JsonParser createJsonParser(InputStream in, Charset charset) throws IOException
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
- Throws:
IOException
-
createJsonParser
public JsonParser createJsonParser(String value) throws IOException
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
- Throws:
IOException
-
-