Android 应用程序的 JSON 实验

2024-01-31

在 Android 上我可以上传一个对象。但是当我尝试下载它时,我在 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);
    }

None

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Android 应用程序的 JSON 实验 的相关文章

随机推荐