Skip to content

Commit 7115734

Browse files
committed
Merge pull request #256 from mziccard/blob-exists-options
Add options parameter to Blob.exists
2 parents 5e1d71b + 77a9dd1 commit 7115734

File tree

2 files changed

+5
-4
lines changed
  • gcloud-java-storage/src

2 files changed

+5
-4
lines changed

gcloud-java-storage/src/main/java/com/google/gcloud/storage/Blob.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,12 @@ public BlobId id() {
150150
/**
151151
* Checks if this blob exists.
152152
*
153+
* @param options blob read options
153154
* @return true if this blob exists, false otherwise
154155
* @throws StorageException upon failure
155156
*/
156-
public boolean exists() {
157-
return storage.get(info.blobId()) != null;
157+
public boolean exists(BlobSourceOption... options) {
158+
return storage.get(info.blobId(), convert(info, options)) != null;
158159
}
159160

160161
/**

gcloud-java-storage/src/test/java/com/google/gcloud/storage/BlobTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,14 @@ public void testInfo() throws Exception {
7070

7171
@Test
7272
public void testExists_True() throws Exception {
73-
expect(storage.get(BLOB_INFO.blobId())).andReturn(BLOB_INFO);
73+
expect(storage.get(BLOB_INFO.blobId(), new Storage.BlobSourceOption[0])).andReturn(BLOB_INFO);
7474
replay(storage);
7575
assertTrue(blob.exists());
7676
}
7777

7878
@Test
7979
public void testExists_False() throws Exception {
80-
expect(storage.get(BLOB_INFO.blobId())).andReturn(null);
80+
expect(storage.get(BLOB_INFO.blobId(), new Storage.BlobSourceOption[0])).andReturn(null);
8181
replay(storage);
8282
assertFalse(blob.exists());
8383
}

0 commit comments

Comments
 (0)