blobtargetoption和blobwriteoption有什么区别

时间:2019-08-07 15:39:14

标签: google-cloud-storage blob option target

我正在练习一些Google云上传,在创建Blob时,我看到两个设置BlobWriteOption.predefinedAcl(Storage.PredefinedAcl acl)BlobTargetOption.predefinedAcl(Storage.PredefinedAcl acl)的选项

我很好奇知道区别。并经历了

  

https://googleapis.dev/java/google-cloud-clients/latest/com/google/cloud/storage/Bucket.BlobTargetOption.html

  

https://dev.ionic.com/sdk_docs/ionic_gcs_sdk/java/version_0.9.1/com/google/cloud/storage/Storage.BlobWriteOption.html

但两者之间并没有太大区别

请帮助我了解它们之间的区别。

1 个答案:

答案 0 :(得分:0)

我找不到很多东西,但是当涉及输入流时,似乎使用了BlobWriteOption。

例如,在此doc上,两种带有流的方法都使用BlobWriteOption

public Blob create(String blob,
                   InputStream content,
                   String contentType,
                   Bucket.BlobWriteOption... options)

public Blob create(String blob,
                   InputStream content,
                   Bucket.BlobWriteOption... options)

与BlobTargetOption相对,没有输入流

public Blob create(String blob,
                   byte[] content,
                   String contentType,
                   Bucket.BlobTargetOption... options)


public Blob create(String blob,
                   byte[] content,
                   Bucket.BlobTargetOption... options)

在这些文档上似乎也重复了这种模式:

https://jar-download.com/artifacts/com.google.cloud/google-cloud-storage/1.14.0/source-code/com/google/cloud/storage/Bucket.java

https://github.com/googleapis/google-cloud-java/blob/master/google-cloud-clients/google-cloud-storage/src/test/java/com/google/cloud/storage/BucketTest.java