com.google.api.client.googleapis.json
Class JsonCContent

java.lang.Object
  extended by com.google.api.client.http.AbstractHttpContent
      extended by com.google.api.client.http.json.JsonHttpContent
          extended by com.google.api.client.googleapis.json.JsonCContent
All Implemented Interfaces:
HttpContent

public final class JsonCContent
extends JsonHttpContent

Serializes JSON-C content based on the data key/value mapping object for an item, wrapped in a "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 JsonHttpContent should be used instead.

Sample usage:

 
  static void setContent(HttpRequest request, Object data) {
    JsonCContent content = new JsonCContent();
    content.jsonFactory = new JacksonFactory();
    content.data = data;
    request.content = content;
  }
 
 

Since:
1.0
Author:
Yaniv Inbar

Constructor Summary
JsonCContent(JsonFactory jsonFactory, Object data)
           
 
Method Summary
 void writeTo(OutputStream out)
           
 
Methods inherited from class com.google.api.client.http.json.JsonHttpContent
getData, getJsonFactory, getType, setType
 
Methods inherited from class com.google.api.client.http.AbstractHttpContent
computeLength, getEncoding, getLength, retrySupported
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JsonCContent

public JsonCContent(JsonFactory jsonFactory,
                    Object data)
Parameters:
jsonFactory - JSON factory to use
data - JSON key name/value data
Since:
1.5
Method Detail

writeTo

public void writeTo(OutputStream out)
             throws IOException
Specified by:
writeTo in interface HttpContent
Overrides:
writeTo in class JsonHttpContent
Throws:
IOException


Copyright © 2010-2012 Google. All Rights Reserved.