public final class JsonCParser
extends com.google.api.client.json.JsonObjectParser
"data" envelope.
Warning: this should only be used by some older Google APIs that wrapped the response in a
"data" envelope. All newer Google APIs don't use this envelope, and for those APIs
JsonObjectParser should be used instead.
Sample usage:
static void setParser(HttpRequest request) {
request.setParser(new JsonCParser(new JacksonFactory()));
}
Implementation is thread-safe.
Upgrade warning: this class now extends JsonObjectParser, whereas in prior version 1.11
it extended JsonHttpParser.
| Constructor and Description |
|---|
JsonCParser(com.google.api.client.json.JsonFactory jsonFactory) |
| Modifier and Type | Method and Description |
|---|---|
com.google.api.client.json.JsonFactory |
getFactory()
Returns the JSON factory used for parsing.
|
static com.google.api.client.json.JsonParser |
initializeParser(com.google.api.client.json.JsonParser parser)
Initializes a JSON parser to use for parsing by skipping over the
"data" or
"error" envelope. |
Object |
parseAndClose(InputStream in,
Charset charset,
Type dataType) |
Object |
parseAndClose(Reader reader,
Type dataType) |
public JsonCParser(com.google.api.client.json.JsonFactory jsonFactory)
jsonFactory - non-null JSON factory used for parsingpublic final com.google.api.client.json.JsonFactory getFactory()
public static com.google.api.client.json.JsonParser initializeParser(com.google.api.client.json.JsonParser parser)
throws IOException
"data" or
"error" envelope.
The parser will be closed if any throwable is thrown. The current token will be the value of
the "data" or "error key.
parser - the parser which should be initialized for normal parsingIllegalArgumentException - if content type is not Json.MEDIA_TYPE or if expected
"data" or "error" key is not foundIOExceptionpublic Object parseAndClose(InputStream in, Charset charset, Type dataType) throws IOException
parseAndClose in interface com.google.api.client.util.ObjectParserparseAndClose in class com.google.api.client.json.JsonObjectParserIOExceptionpublic Object parseAndClose(Reader reader, Type dataType) throws IOException
parseAndClose in interface com.google.api.client.util.ObjectParserparseAndClose in class com.google.api.client.json.JsonObjectParserIOExceptionCopyright © 2010-2013 Google. All Rights Reserved.