Skip to content

Commit 937e923

Browse files
committed
---
yaml --- r: 1005 b: refs/heads/master c: c552ede h: refs/heads/master i: 1003: 71bd268 v: v3
1 parent e34c527 commit 937e923

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: b1918ca205078c37b249d4367d3d8b584e922ca0
2+
refs/heads/master: c552edebd9bcd349366d45875a9e9d8d35db2514
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/Bucket.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import com.google.gcloud.storage.Storage.BucketTargetOption;
2626

2727
import java.util.ArrayList;
28+
import java.util.Collections;
2829
import java.util.List;
2930
import java.util.Objects;
3031

@@ -146,21 +147,26 @@ public Blob get(String blob, BlobSourceOption... options) {
146147
/**
147148
* Returns a list of requested blobs in this bucket. Blobs that do not exist are null.
148149
*
149-
* @param blobNames names of the requested blobs
150+
* @param blobName1 first blob to get
151+
* @param blobName2 second blob to get
152+
* @param blobNames other blobs to get
153+
* @return an immutable list of {@code Blob} objects.
150154
* @throws StorageException upon failure
151155
*/
152-
public List<Blob> getAll(String... blobNames) {
156+
public List<Blob> get(String blobName1, String blobName2, String... blobNames) {
153157
BatchRequest.Builder batch = BatchRequest.builder();
154-
for (String blobName : blobNames) {
155-
batch.get(info.name(), blobName);
158+
batch.get(info.name(), blobName1);
159+
batch.get(info.name(), blobName2);
160+
for (String name : blobNames) {
161+
batch.get(info.name(), name);
156162
}
157163
List<Blob> blobs = new ArrayList<>(blobNames.length);
158164
BatchResponse response = storage.apply(batch.build());
159165
for (BatchResponse.Result<BlobInfo> result : response.gets()) {
160166
BlobInfo blobInfo = result.get();
161167
blobs.add(blobInfo != null ? new Blob(storage, blobInfo) : null);
162168
}
163-
return blobs;
169+
return Collections.unmodifiableList(blobs);
164170
}
165171

166172
/**

trunk/gcloud-java-storage/src/test/java/com/google/gcloud/storage/BucketTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ public void testGetAll() throws Exception {
143143
new BatchResponse(Collections.EMPTY_LIST, Collections.EMPTY_LIST, batchResultList);
144144
expect(storage.apply(capture(capturedBatchRequest))).andReturn(response);
145145
replay(storage);
146-
List<Blob> blobs = bucket.getAll("n1", "n2", "n3");
146+
List<Blob> blobs = bucket.get("n1", "n2", "n3");
147147
Set<BlobInfo> blobInfoSet = capturedBatchRequest.getValue().toGet().keySet();
148148
assertEquals(batchResultList.size(), blobInfoSet.size());
149149
for (BlobInfo info : BLOB_INFO_RESULTS) {

0 commit comments

Comments
 (0)