Skip to content

Commit 454eaa2

Browse files
author
Frank Natividad
committed
Update issues in the snippets.
1 parent e46b57c commit 454eaa2

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

google-cloud-examples/src/main/java/com/google/cloud/examples/storage/snippets/StorageSnippets.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,8 +1114,6 @@ public Bucket getRequesterPaysStatus(String bucketName) throws StorageException
11141114
public void downloadFileUsingRequesterPays(String projectId, String bucketName,
11151115
String srcFilename, Path destFilePath) throws IOException {
11161116
// [START storage_download_file_requester_pays]
1117-
// Instantiate a Google Cloud Storage client
1118-
11191117
// The project ID to bill
11201118
// String projectId = "my-billable-project-id";
11211119

@@ -1131,14 +1129,11 @@ public void downloadFileUsingRequesterPays(String projectId, String bucketName,
11311129
// Instantiate a Google Cloud Storage client
11321130
Storage storage = StorageOptions.getDefaultInstance().getService();
11331131

1134-
// Set billing project
1135-
BlobSourceOption option = BlobSourceOption.userProject(projectId);
1136-
11371132
// Get specific file from specified bucket
1138-
Blob blob = BlobId.of(bucketName, srcFilename);
1133+
Blob blob = storage.get(BlobId.of(bucketName, srcFilename));
11391134

11401135
// Download file to specified path
1141-
blob.downloatTo(destFilePath, option);
1136+
blob.downloadTo(destFilePath, Blob.BlobSourceOption.userProject(projectId));
11421137
// [END storage_download_file_requester_pays]
11431138
}
11441139
}

0 commit comments

Comments
 (0)