3

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

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

代码来自谷歌示例:

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);
    }
4

0 回答 0