2

我的应用程序在谷歌应用引擎上运行,所以不能使用文件。我想将其他网站上的 pdf 文件保存到谷歌驱动器,但得到 IllegalArgumentException

file.setMimeType("application/pdf");
mediaContent = new InputStreamContent(file.getMimeType(),
                   url.openStream());

try {
    File result = getDrive().files().insert(file, mediaContent)
                .execute();
        return result.getId();
    } catch (Exception e) {
        e.printStackTrace();
    }

谢谢

4

1 回答 1

0

查看 Google Drive SDK 文档以获取在 App Engine 上运行的完整 Java 示例应用程序,展示如何读取文件并将其保存到 Drive:

https://developers.google.com/drive/examples/java

于 2012-11-28T19:31:25.153 回答