String uploadId = client.initiateMultipartUpload(container, slicer.getPartSizeInMB(),
blob.getMetadata().getName());
try {
ImmutableMap.Builder<Integer, HashCode> hashes = ImmutableMap.builder();
while (slicer.hasNext()) {
PayloadSlice slice = slicer.nextSlice();
hashes.put(slice.getPart(),
client.uploadPart(container, uploadId, slice.getRange(), slice.getPayload()));
}
return client.completeMultipartUpload(container, uploadId, hashes.build(),
blob.getPayload().getContentMetadata().getContentLength());
} catch (RuntimeException exception) {
client.abortMultipartUpload(container, uploadId);