本文整理了Java中com.google.cloud.storage.Blob.getStorageClass()
方法的一些代码示例,展示了Blob.getStorageClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Blob.getStorageClass()
方法的具体详情如下:
包路径:com.google.cloud.storage.Blob
类名称:Blob
方法名:getStorageClass
暂无
代码示例来源:origin: googleapis/google-cloud-java
System.out.println("Name: " + blob.getName());
System.out.println("Size: " + blob.getSize());
System.out.println("StorageClass: " + blob.getStorageClass());
System.out.println("TimeCreated: " + new Date(blob.getCreateTime()));
System.out.println("Last Metadata Update: " + new Date(blob.getUpdateTime()));
代码示例来源:origin: googleapis/google-cloud-java
public void testCopyBlobUpdateStorageClass() {
String sourceBlobName = "test-copy-blob-update-storage-class-source";
BlobId source = BlobId.of(BUCKET, sourceBlobName);
BlobInfo sourceInfo =
BlobInfo.newBuilder(source).setStorageClass(StorageClass.STANDARD).build();
Blob remoteSourceBlob = storage.create(sourceInfo, BLOB_BYTE_CONTENT);
assertNotNull(remoteSourceBlob);
assertEquals(StorageClass.STANDARD, remoteSourceBlob.getStorageClass());
String targetBlobName = "test-copy-blob-update-storage-class-target";
BlobInfo targetInfo =
BlobInfo.newBuilder(BUCKET, targetBlobName).setStorageClass(StorageClass.COLDLINE).build();
Storage.CopyRequest req = Storage.CopyRequest.of(source, targetInfo);
CopyWriter copyWriter = storage.copy(req);
assertEquals(BUCKET, copyWriter.getResult().getBucket());
assertEquals(targetBlobName, copyWriter.getResult().getName());
assertEquals(StorageClass.COLDLINE, copyWriter.getResult().getStorageClass());
assertTrue(copyWriter.isDone());
assertTrue(remoteSourceBlob.delete());
assertTrue(storage.delete(BUCKET, targetBlobName));
}
内容来源于网络,如有侵权,请联系作者删除!