本文介绍了如何使用Java将媒体(图像,视频)上传到Google Cloud Storage的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

将媒体文件上传到 Google云端存储后,我现在遇到问题 a>使用Google Cloud Storage API Java.更具体地说,GCS API Java示例仅帮助我们将文本文件上传到Google Bucket,但对媒体文件没有用.我还从票证中看到了一些讨论:书面文件未显示在Google中团队建议使用Cloud Storage ,该工具使用Python编写的gsutil工具.我也不使用blobstore

I am now facing with a problem once uploading media files to Google Cloud Storage by using Google Cloud Storage API Java. To be more specific, the GCS API Java example just help us upload text files to Google Bucket but is not useful for media files. I also see some discussion from ticket: Written file not showing up in Google Cloud Storage that the team suggest to use a gsutil tool written by Python. I am not using blobstore as well

我的问题是我该如何满足以下要求:-创建和删除存储桶.-上载,下载和删除对象(例如媒体文件).-列出存储桶和对象.-移动,复制和重命名对象.

My question is how can I do with the following requirements:-Creating and deleting buckets.-Uploading, downloading, and deleting objects (such as media files).-Listing buckets and objects.-Moving, copying, and renaming objects.

通过Java实现?

非常感谢您的宝贵时间,并希望能收到您的来信.

I thank you very much for your time and look forward to hearing from you.

推荐答案

  • 上传/下载文件:您可以使用 Blobstore API 可以配置为通过在 BlobstoreService createUploadUrl .同样,要下载,您可以使用存储桶名称+对象名称创建createGsBlobKey,然后Blobstore服务即可为其提供服务.
  • 创建/删除存储桶: Google Cloud Storage Java客户端库没有提供创建/删除存储桶的方法.您将需要使用Google Cloud Storage REST API以编程方式创建删除.想一想,您可能需要考虑在一个存储桶中组织数据.
  • 移动,复制和重命名对象:利用 Google Cloud Storage Java客户端库
    • Upload/Download files: you can use the Blobstore API which can be configured to store blobs in Google Cloud Storage by specifying your bucket in the BlobstoreService createUploadUrl. Similarly, to download you can create a createGsBlobKey with the Bucket name + Object name which can then be served by the Blobstore service.
    • Create/Delete buckets: The Google Cloud Storage Java Client Library does not offers a way to create/delete buckets. You will need to use Google Cloud Storage REST API to programatically create and delete. Thought, you might want to consider organizing your data within one bucket.
    • Moving, copying, and renaming objects: make use of the Google Cloud Storage Java Client Library
    • 这篇关于如何使用Java将媒体(图像,视频)上传到Google Cloud Storage的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-21 01:45