gpt4 book ai didi

java - 如何在 Google Cloud Storage 中批量上传对象?

转载 作者:行者123 更新时间:2023-11-30 05:32:04 29 4
gpt4 key购买 nike

我正在使用 Google Cloud Storage 和 Java,我需要批量上传 1000 个对象到 GCS。

这是GCS提供的文档

Storage storage = StorageOptions.getDefaultInstance().getService();
BlobId blobId = BlobId.of("bucket", "blob_name");
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
Blob blob = storage.create(blobInfo, "Hello, Cloud Storage!".getBytes(UTF_8));

但它只适用于一个对象,我一直在寻找批处理函数,但没有找到它,因此我必须使用 for 逐个对象上传。

最佳答案

目前还没有。您可以在此处了解现有积压的功能请求:https://github.com/googleapis/google-cloud-java/issues/2351

关于java - 如何在 Google Cloud Storage 中批量上传对象?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57318258/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com