use of com.google.cloud.storage.Storage.ComposeRequest in project google-cloud-java by GoogleCloudPlatform.
the class StorageSnippets method composeBlobs.
/**
* Example of composing two blobs.
*/
// [TARGET compose(ComposeRequest)]
// [VARIABLE "my_unique_bucket"]
// [VARIABLE "my_blob_name"]
// [VARIABLE "source_blob_1"]
// [VARIABLE "source_blob_2"]
public Blob composeBlobs(String bucketName, String blobName, String sourceBlob1, String sourceBlob2) {
// [START composeBlobs]
BlobId blobId = BlobId.of(bucketName, blobName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
ComposeRequest request = ComposeRequest.newBuilder().setTarget(blobInfo).addSource(sourceBlob1).addSource(sourceBlob2).build();
Blob blob = storage.compose(request);
// [END composeBlobs]
return blob;
}
Aggregations