A batch of operations to be submitted to Google Cloud Storage using a single RPC request.
Example of using a batch request to delete, update and get a blob:
StorageBatchbatch=storage.batch();BlobIdfirstBlob=BlobId.of("bucket","blob1"));BlobIdsecondBlob=BlobId.of("bucket","blob2"));batch.delete(firstBlob).notify(newBatchResult.Callback<Boolean,StorageException>(){publicvoidsuccess(Booleanresult){// deleted successfully}publicvoiderror(StorageExceptionexception){// delete failed}});batch.update(BlobInfo.builder(secondBlob).contentType("text/plain").build());StorageBatchResult<Blob>result=batch.get(secondBlob);batch.submit();Blobblob=result.get();// returns get result or throws StorageException
Adds a request representing the "delete blob" operation to this batch. Calling StorageBatchResult#get() on the return value yields true upon successful deletion,
false if the blob was not found, or throws a StorageException if the operation
failed.
Adds a request representing the "delete blob" operation to this batch. Calling StorageBatchResult#get() on the return value yields true upon successful deletion,
false if the blob was not found, or throws a StorageException if the operation
failed.
Adds a request representing the "get blob" operation to this batch. The options can be
used in the same way as for Storage#get(BlobId, BlobGetOption...). Calling StorageBatchResult#get() on the return value yields the requested Blob if successful,
null if no such blob exists, or throws a StorageException if the operation
failed.
Adds a request representing the "get blob" operation to this batch. The options can be
used in the same way as for Storage#get(BlobId, BlobGetOption...). Calling StorageBatchResult#get() on the return value yields the requested Blob if successful,
null if no such blob exists, or throws a StorageException if the operation
failed.
Adds a request representing the "update blob" operation to this batch. The options can
be used in the same way as for Storage#update(BlobInfo, BlobTargetOption...). Calling
StorageBatchResult#get() on the return value yields the updated Blob if
successful, or throws a StorageException if the operation failed.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-12-18 UTC."],[],[]]