use of com.google.cloud.storage.CopyWriter in project google-cloud-java by GoogleCloudPlatform.
the class BlobSnippets method copyToId.
/**
* Example of copying the blob to a different bucket with a different name.
*/
// [TARGET copyTo(BlobId, BlobSourceOption...)]
// [VARIABLE "my_unique_bucket"]
// [VARIABLE "copy_blob_name"]
public Blob copyToId(String bucketName, String blobName) {
// [START copyToId]
CopyWriter copyWriter = blob.copyTo(BlobId.of(bucketName, blobName));
Blob copiedBlob = copyWriter.getResult();
// [END copyToId]
return copiedBlob;
}
Aggregations