Skip to content

Commit fa7d7fc

Browse files
committed
Minor updates javadoc Blob, Bucket, ListResult
1 parent eb9ea81 commit fa7d7fc

3 files changed

Lines changed: 32 additions & 31 deletions

File tree

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

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static Storage.BlobSourceOption[] convert(BlobInfo blobInfo, BlobSourceOption...
9292
}
9393

9494
/**
95-
* Construct a {@code Blob} object for the provided {@code BlobInfo}. The storage service is used
95+
* Constructs a {@code Blob} object for the provided {@code BlobInfo}. The storage service is used
9696
* to issue requests.
9797
*
9898
* @param storage the storage service used for issuing requests
@@ -104,7 +104,7 @@ public Blob(Storage storage, BlobInfo info) {
104104
}
105105

106106
/**
107-
* Construct a {@code Blob} object for the provided bucket and blob names. The storage service is
107+
* Constructs a {@code Blob} object for the provided bucket and blob names. The storage service is
108108
* used to issue requests.
109109
*
110110
* @param storage the storage service used for issuing requests
@@ -117,14 +117,14 @@ public Blob(Storage storage, String bucket, String blob) {
117117
}
118118

119119
/**
120-
* Return the blob's information.
120+
* Returns the blob's information.
121121
*/
122122
public BlobInfo info() {
123123
return info;
124124
}
125125

126126
/**
127-
* Check if this blob exists.
127+
* Checks if this blob exists.
128128
*
129129
* @return true if this blob exists, false otherwise
130130
* @throws StorageException upon failure
@@ -134,7 +134,7 @@ public boolean exists() {
134134
}
135135

136136
/**
137-
* Return this blob's content.
137+
* Returns this blob's content.
138138
*
139139
* @param options blob read options
140140
* @throws StorageException upon failure
@@ -155,12 +155,12 @@ public Blob reload(BlobSourceOption... options) {
155155
}
156156

157157
/**
158-
* Update the blob's information. Bucket or blob's name cannot be changed by this method. If you
158+
* Updates the blob's information. Bucket or blob's name cannot be changed by this method. If you
159159
* want to rename the blob or move it to a different bucket use the {@link #copyTo} and
160160
* {@link #delete} operations. A new {@code Blob} object is returned. By default no checks are
161161
* made on the metadata generation of the current blob. If you want to update the information only
162162
* if the current blob metadata are at their latest version use the {@code metagenerationMatch}
163-
* option: {@code blob.update(newInfo, BlobTargetOption.metagenerationMatch()}.
163+
* option: {@code blob.update(newInfo, BlobTargetOption.metagenerationMatch())}.
164164
*
165165
* @param blobInfo new blob's information. Bucket and blob names must match the current ones
166166
* @param options update options
@@ -174,7 +174,7 @@ public Blob update(BlobInfo blobInfo, BlobTargetOption... options) {
174174
}
175175

176176
/**
177-
* Delete this blob.
177+
* Deletes this blob.
178178
*
179179
* @param options blob delete options
180180
* @return true if blob was deleted
@@ -185,7 +185,8 @@ public boolean delete(BlobSourceOption... options) {
185185
}
186186

187187
/**
188-
* Copy this blob to the target bucket, preserving its name. Possibly update metadata.
188+
* Copies this blob to the target bucket, preserving its name. Possibly copying also some of the
189+
* metadata (e.g. content-type).
189190
*
190191
* @param targetBucket target bucket's name
191192
* @param options source blob options
@@ -197,7 +198,8 @@ public Blob copyTo(String targetBucket, BlobSourceOption... options) {
197198
}
198199

199200
/**
200-
* Copy this blob to the target bucket with a new name. Possibly update metadata.
201+
* Copies this blob to the target bucket with a new name. Possibly copying also some of the
202+
* metadata (e.g. content-type).
201203
*
202204
* @param targetBucket target bucket's name
203205
* @param targetBlob target blob's name
@@ -214,7 +216,7 @@ public Blob copyTo(String targetBucket, String targetBlob, BlobSourceOption... o
214216
}
215217

216218
/**
217-
* Return a {@code BlobReadChannel} object for reading this blob's content.
219+
* Returns a {@code BlobReadChannel} object for reading this blob's content.
218220
*
219221
* @param options blob read options
220222
* @throws StorageException upon failure
@@ -224,7 +226,7 @@ public BlobReadChannel reader(BlobSourceOption... options) {
224226
}
225227

226228
/**
227-
* Return a {@code BlobWriteChannel} object for writing to this blob.
229+
* Returns a {@code BlobWriteChannel} object for writing to this blob.
228230
*
229231
* @param options target blob options
230232
* @throws StorageException upon failure
@@ -234,7 +236,7 @@ public BlobWriteChannel writer(BlobTargetOption... options) {
234236
}
235237

236238
/**
237-
* Generate a signed URL for this blob. If you want to allow access to for a fixed amount of time
239+
* Generates a signed URL for this blob. If you want to allow access to for a fixed amount of time
238240
* for this blob, you can use this method to generate a URL that is only valid within a certain
239241
* time period. This is particularly useful if you don't want publicly accessible blobs, but don't
240242
* want to require users to explicitly log in.
@@ -249,7 +251,7 @@ public URL signUrl(long expirationTimeInSeconds, SignUrlOption... options) {
249251
}
250252

251253
/**
252-
* Return the blob's {@code Storage} object used to issue requests.
254+
* Returns the blob's {@code Storage} object used to issue requests.
253255
*/
254256
public Storage storage() {
255257
return storage;

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

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,13 @@
1818

1919
import static com.google.common.base.Preconditions.checkArgument;
2020
import static com.google.common.base.Preconditions.checkNotNull;
21-
import static com.google.gcloud.storage.Blob.BlobSourceOption.convert;
2221

2322
import com.google.gcloud.storage.Storage.BlobSourceOption;
2423
import com.google.gcloud.storage.Storage.BlobTargetOption;
2524
import com.google.gcloud.storage.Storage.BucketSourceOption;
2625
import com.google.gcloud.storage.Storage.BucketTargetOption;
2726

28-
import java.util.LinkedList;
27+
import java.util.ArrayList;
2928
import java.util.List;
3029
import java.util.Objects;
3130

@@ -44,7 +43,7 @@ public final class Bucket {
4443
private final BucketInfo info;
4544

4645
/**
47-
* Construct a {@code Bucket} object for the provided {@code BucketInfo}. The storage service is
46+
* Constructs a {@code Bucket} object for the provided {@code BucketInfo}. The storage service is
4847
* used to issue requests.
4948
*
5049
* @param storage the storage service used for issuing requests
@@ -56,7 +55,7 @@ public Bucket(Storage storage, BucketInfo info) {
5655
}
5756

5857
/**
59-
* Construct a {@code Bucket} object for the provided name. The storage service is used to issue
58+
* Constructs a {@code Bucket} object for the provided name. The storage service is used to issue
6059
* requests.
6160
*
6261
* @param storage the storage service used for issuing requests
@@ -68,14 +67,14 @@ public Bucket(Storage storage, String bucket) {
6867
}
6968

7069
/**
71-
* Return the bucket's information.
70+
* Returns the bucket's information.
7271
*/
7372
public BucketInfo info() {
7473
return info;
7574
}
7675

7776
/**
78-
* Check if this bucket exists.
77+
* Checks if this bucket exists.
7978
*
8079
* @return true if this bucket exists, false otherwise
8180
* @throws StorageException upon failure
@@ -96,11 +95,11 @@ public Bucket reload(BucketSourceOption... options) {
9695
}
9796

9897
/**
99-
* Update the bucket's information. Bucket's name cannot be changed. A new {@code Bucket} object
98+
* Updates the bucket's information. Bucket's name cannot be changed. A new {@code Bucket} object
10099
* is returned. By default no checks are made on the metadata generation of the current bucket.
101100
* If you want to update the information only if the current bucket metadata are at their latest
102101
* version use the {@code metagenerationMatch} option:
103-
* {@code bucket.update(newInfo, BucketTargetOption.metagenerationMatch());}
102+
* {@code bucket.update(newInfo, BucketTargetOption.metagenerationMatch())}
104103
*
105104
* @param bucketInfo new bucket's information. Name must match the one of the current bucket
106105
* @param options update options
@@ -113,7 +112,7 @@ public Bucket update(BucketInfo bucketInfo, BucketTargetOption... options) {
113112
}
114113

115114
/**
116-
* Delete this bucket.
115+
* Deletes this bucket.
117116
*
118117
* @param options bucket delete options
119118
* @return true if bucket was deleted
@@ -124,7 +123,7 @@ public boolean delete(BucketSourceOption... options) {
124123
}
125124

126125
/**
127-
* Return the paginated list of {@code Blob} in this bucket.
126+
* Returns the paginated list of {@code Blob} in this bucket.
128127
*
129128
* @param options options for listing blobs
130129
* @throws StorageException upon failure
@@ -134,7 +133,7 @@ public ListResult<Blob> list(Storage.BlobListOption... options) {
134133
}
135134

136135
/**
137-
* Return the requested blob in this bucket or {@code null} if not found.
136+
* Returns the requested blob in this bucket or {@code null} if not found.
138137
*
139138
* @param blob name of the requested blob
140139
* @param options blob search options
@@ -145,7 +144,7 @@ public Blob get(String blob, BlobSourceOption... options) {
145144
}
146145

147146
/**
148-
* Return a list of requested blobs in this bucket. Blobs that do not exist are null.
147+
* Returns a list of requested blobs in this bucket. Blobs that do not exist are null.
149148
*
150149
* @param blobNames names of the requested blobs
151150
* @throws StorageException upon failure
@@ -155,7 +154,7 @@ public List<Blob> getAll(String... blobNames) {
155154
for (String blobName : blobNames) {
156155
batch.get(info.name(), blobName);
157156
}
158-
List<Blob> blobs = new LinkedList<>();
157+
List<Blob> blobs = new ArrayList<>(blobNames.length);
159158
BatchResponse response = storage.apply(batch.build());
160159
for (BatchResponse.Result<BlobInfo> result : response.gets()) {
161160
BlobInfo blobInfo = result.get();
@@ -165,7 +164,7 @@ public List<Blob> getAll(String... blobNames) {
165164
}
166165

167166
/**
168-
* Create a new blob in this bucket.
167+
* Creates a new blob in this bucket.
169168
*
170169
* @param blob a blob name
171170
* @param content the blob content
@@ -179,7 +178,7 @@ Blob create(String blob, byte[] content, BlobTargetOption... options) {
179178
}
180179

181180
/**
182-
* Return the bucket's {@code Storage} object used to issue requests.
181+
* Returns the bucket's {@code Storage} object used to issue requests.
183182
*/
184183
public Storage storage() {
185184
return storage;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@
2222
public interface ListResult<T> extends Iterable<T> {
2323

2424
/**
25-
* Return the cursor for the nextPage or {@code null} if no more results.
25+
* Returns the cursor for the nextPage or {@code null} if no more results.
2626
*/
2727
String nextPageCursor();
2828

2929
/**
30-
* Return the results of the nextPage or {@code null} if no more result.
30+
* Returns the results of the nextPage or {@code null} if no more result.
3131
*/
3232
ListResult<T> nextPage();
3333

0 commit comments

Comments
 (0)