Package com.google.api.client.http.json

Examples of com.google.api.client.http.json.JsonHttpContent.writeTo()


  }

  public static <T> String parseDoubanObjToJSONStr(T obj) throws IOException {
    JsonHttpContent content = new JsonHttpContent(new JacksonFactory(), obj);
    ByteArrayOutputStream os = new ByteArrayOutputStream();
    content.writeTo(os);
    String result = new String(os.toByteArray());
    return result;
  }
 
  public static <T> String parseDoubanObjToXMLStr(T obj) throws IOException {
View Full Code Here


  private static void parseJson () {
    try {
      DoubanShuoAttachementObj att = generateAtt();
      JsonHttpContent content = new JsonHttpContent(new JacksonFactory(), att);
      ByteArrayOutputStream os = new ByteArrayOutputStream();
      content.writeTo(os);
      String result = new String(os.toByteArray());
      System.out.println("result ! : " + result);
      System.out.println("getdate : " + (String)content.getData());
    } catch (IOException ex) {
      Logger.getLogger(PlayGround.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.