Skip to content

Commit fad8807

Browse files
yihanzhenpongad
authored andcommitted
Make download in StorageExamples more straightforward (#2905)
1 parent 6fdc893 commit fad8807

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

google-cloud-examples/src/main/java/com/google/cloud/examples/storage/StorageExample.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,10 +352,11 @@ private static class DownloadAction extends StorageAction<Tuple<BlobId, Path>> {
352352

353353
@Override
354354
public void run(Storage storage, Tuple<BlobId, Path> tuple) throws IOException {
355-
run(storage, tuple.x(), tuple.y());
355+
run(storage, tuple.x().getBucket(), tuple.x().getName(), tuple.y());
356356
}
357357

358-
private void run(Storage storage, BlobId blobId, Path downloadTo) throws IOException {
358+
private void run(Storage storage, String bucketName, String objectName, Path downloadTo) throws IOException {
359+
BlobId blobId = BlobId.of(bucketName, objectName);
359360
Blob blob = storage.get(blobId);
360361
if (blob == null) {
361362
System.out.println("No such object");

0 commit comments

Comments
 (0)