来自Android App的JSON实验

时间:2013-03-22 23:06:47

标签: android google-cloud-storage

在Android上我可以上传一个对象Ok。但是当我尝试下载它时,我在getObject.executeMediaAndDownloadTo(out)上收到以下错误。

java.lang.IllegalArgumentException: Type must be in the 'maintype/subtype; parameter=value' format

代码来自Google示例:

Storage.Objects.Get getObject = storage.objects().get("bucket", "myObject");
if (getMetadata == true) {
    getObject.setAlt("json");  // Temporary workaround.
    StorageObject object = getObject.execute();
} else {
    // Downloading data.
    out = new ByteArrayOutputStream();
    // If you're not in AppEngine, download the whole thing in one request, if possible.
    // NOTE: As of right now, this will not retry on retryable failure.
    // http://code.google.com/p/google-api-java-client/issues/detail?id=579
    getObject.getMediaHttpDownloader().setDirectDownloadEnabled(true);
    getObject.executeMediaAndDownloadTo(out);
    }

0 个答案:

没有答案