|
25 | 25 | import com.google.gcloud.storage.Storage.BucketTargetOption; |
26 | 26 |
|
27 | 27 | import java.util.ArrayList; |
| 28 | +import java.util.Collections; |
28 | 29 | import java.util.List; |
29 | 30 | import java.util.Objects; |
30 | 31 |
|
@@ -146,21 +147,26 @@ public Blob get(String blob, BlobSourceOption... options) { |
146 | 147 | /** |
147 | 148 | * Returns a list of requested blobs in this bucket. Blobs that do not exist are null. |
148 | 149 | * |
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. |
150 | 154 | * @throws StorageException upon failure |
151 | 155 | */ |
152 | | - public List<Blob> getAll(String... blobNames) { |
| 156 | + public List<Blob> get(String blobName1, String blobName2, String... blobNames) { |
153 | 157 | 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); |
156 | 162 | } |
157 | 163 | List<Blob> blobs = new ArrayList<>(blobNames.length); |
158 | 164 | BatchResponse response = storage.apply(batch.build()); |
159 | 165 | for (BatchResponse.Result<BlobInfo> result : response.gets()) { |
160 | 166 | BlobInfo blobInfo = result.get(); |
161 | 167 | blobs.add(blobInfo != null ? new Blob(storage, blobInfo) : null); |
162 | 168 | } |
163 | | - return blobs; |
| 169 | + return Collections.unmodifiableList(blobs); |
164 | 170 | } |
165 | 171 |
|
166 | 172 | /** |
|
0 commit comments