Package com.google.api.client.util

Examples of com.google.api.client.util.ObjectParser.parseAndClose()


    }

    // Check if we have an ObjectParser that we can use
    ObjectParser objectParser = request.getParser();
    if (objectParser != null) {
      return objectParser.parseAndClose(getContent(), getContentCharset(), dataClass);
    }

    // Otherwise fall back to the deprecated implementation
    HttpParser parser = getParser();
    if (parser == null) {
View Full Code Here


   */
  public Object parseAs(Type dataType) throws IOException {
    // Check if we have an ObjectParser that we can use
    ObjectParser objectParser = request.getParser();
    Preconditions.checkArgument(objectParser != null, "No ObjectParser defined for response");
    return objectParser.parseAndClose(getContent(), getContentCharset(), dataType);
  }

  /**
   * Parses the content of the HTTP response from {@link #getContent()} and reads it into a string.
   *
 
View Full Code Here

    // TODO(mlinder): Remove the HttpResponse reference and directly parse the InputStream
    com.google.api.client.http.HttpParser oldParser = requestInfo.request.getParser(contentType);
    ObjectParser parser = requestInfo.request.getParser();
    A parsed = null;
    if (dataClass != Void.class) {
      parsed = parser != null ? parser.parseAndClose(
          response.getContent(), response.getContentCharset(), dataClass) : oldParser.parse(
          response, dataClass);
    }
    return parsed;
  }
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.