How to download a file from Google Cloud Storage with Java?

后端 未结 3 686
不知归路
不知归路 2020-12-10 19:58

I\'m developping an application that provides users with an interface where they can download files from our Google Cloud Storage. I wrote unit tests and I could connect to

3条回答
  •  [愿得一人]
    2020-12-10 20:15

    As you say, currently you're downloading the metadata. You need to use media download to download the object's data.

    Take a look at the sample Java code here: https://developers.google.com/storage/docs/json_api/v1/objects/get

    That is the simplest method, using getMediaHttpDownloader().

    There is more info on media and the other method, resumable download, here: https://code.google.com/p/google-api-java-client/wiki/MediaDownload

提交回复
热议问题