久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

如何使用驅動器 api java 從谷歌驅動器下載文件

How to download a file from google drive using drive api java?(如何使用驅動器 api java 從谷歌驅動器下載文件?)
本文介紹了如何使用驅動器 api java 從谷歌驅動器下載文件?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我嘗試了谷歌驅動的一些功能,但我無法從驅動器下載文件.

I have tried some functions of Google drive, but I couldn't able to download the file from Drive.

這是我使用的代碼

private static InputStream downloadFile(Drive service, File file) {
    if (file.getDownloadUrl() != null && file.getDownloadUrl().length() > 0) {
      try {
        HttpResponse resp =
            service.getRequestFactory().buildGetRequest(new GenericUrl(file.getDownloadUrl()))
                .execute();
        return resp.getContent();
      } catch (IOException e) {
        // An error occurred.
        e.printStackTrace();
        return null;
      }
    } else {
      // The file doesn't have any content stored on Drive.
      return null;
    }
  }

當我運行腳本時,它顯示 file.getDownloadUrl() 為 NULL.

When I ran the script it shows file.getDownloadUrl() is NULL.

我錯過了什么?

在我調用下載函數之前添加以下行后它正在執行

Now it's executing after adding the following line before I call the download function

File file1 = service.files().get(fileid).execute();
downloadFile(service,file1);

現在的問題是如何借助我從腳本中獲得的響應"來下載文件....

Now the problem is how to download the file with the help of 'response' which I got from the script....

推薦答案

Google Docs 原生格式的文檔沒有 downloadUrl 字段,您可以使用 exportLinks 集合:

Documents in Google Docs native formats won't have a downloadUrl field, instead you can export them using the exportLinks collection:

https://developers.google.com/drive/manage-downloads#downloading_google_documents

這篇關于如何使用驅動器 api java 從谷歌驅動器下載文件?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

Upload progress listener not fired (Google drive API)(上傳進度偵聽器未觸發(Google 驅動器 API))
Save file in specific folder with Google Drive SDK(使用 Google Drive SDK 將文件保存在特定文件夾中)
Google Drive Android API - Invalid DriveId and Null ResourceId(Google Drive Android API - 無效的 DriveId 和 Null ResourceId)
Google drive api services account view uploaded files to google drive using java(谷歌驅動api服務賬戶查看上傳文件到谷歌驅動使用java)
Google Drive service account returns 403 usageLimits(Google Drive 服務帳號返回 403 usageLimits)
com.google.api.client.json.jackson.JacksonFactory; missing in Google Drive example(com.google.api.client.json.jackson.JacksonFactory;Google Drive 示例中缺少)
主站蜘蛛池模板: 国产精品黄色 | 欧美一区二区二区 | 日本在线播放 | 九九成人 | 日韩在线资源 | 高清av一区 | 亚洲国产精品一区二区第一页 | 91在线精品视频 | 婷婷精品 | 在线观看深夜视频 | 色网站在线 | 成人国产精品久久久 | 中国av在线免费观看 | 亚洲一区二区在线视频 | 国产亚洲精品精品国产亚洲综合 | 欧美日韩国产一区二区三区 | 日韩一区二区在线视频 | 日韩欧美一级精品久久 | 中文字幕av色 | 欧美国产视频 | 国产欧美日韩在线播放 | 日韩视频精品在线 | 99热在线观看精品 | 3级毛片| 亚洲精品免费视频 | 美女久久久久久久久 | 97国产精品 | 国产日韩亚洲欧美 | 日本在线看片 | 国产视频中文字幕 | 亚洲欧美日韩在线 | 免费观看的av毛片的网站 | 国产精品视频在 | 国产亚洲成av人在线观看导航 | 在线看h| 亚洲淫视频| 国产999精品久久久 日本视频一区二区三区 | 国产精品完整版 | 成年人黄色一级毛片 | 九七午夜剧场福利写真 | 国产免费一区二区 |