Skip to content

Commit

Permalink
Minor updates javadoc Blob, Bucket, ListResult
Browse files Browse the repository at this point in the history
  • Loading branch information
mziccard committed Sep 25, 2015
1 parent eb9ea81 commit fa7d7fc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ static Storage.BlobSourceOption[] convert(BlobInfo blobInfo, BlobSourceOption...
}

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

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

/**
* Return the blob's information.
* Returns the blob's information.
*/
public BlobInfo info() {
return info;
}

/**
* Check if this blob exists.
* Checks if this blob exists.
*
* @return true if this blob exists, false otherwise
* @throws StorageException upon failure
Expand All @@ -134,7 +134,7 @@ public boolean exists() {
}

/**
* Return this blob's content.
* Returns this blob's content.
*
* @param options blob read options
* @throws StorageException upon failure
Expand All @@ -155,12 +155,12 @@ public Blob reload(BlobSourceOption... options) {
}

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

/**
* Delete this blob.
* Deletes this blob.
*
* @param options blob delete options
* @return true if blob was deleted
Expand All @@ -185,7 +185,8 @@ public boolean delete(BlobSourceOption... options) {
}

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

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

/**
* Return a {@code BlobReadChannel} object for reading this blob's content.
* Returns a {@code BlobReadChannel} object for reading this blob's content.
*
* @param options blob read options
* @throws StorageException upon failure
Expand All @@ -224,7 +226,7 @@ public BlobReadChannel reader(BlobSourceOption... options) {
}

/**
* Return a {@code BlobWriteChannel} object for writing to this blob.
* Returns a {@code BlobWriteChannel} object for writing to this blob.
*
* @param options target blob options
* @throws StorageException upon failure
Expand All @@ -234,7 +236,7 @@ public BlobWriteChannel writer(BlobTargetOption... options) {
}

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

/**
* Return the blob's {@code Storage} object used to issue requests.
* Returns the blob's {@code Storage} object used to issue requests.
*/
public Storage storage() {
return storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@

import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
import static com.google.gcloud.storage.Blob.BlobSourceOption.convert;

import com.google.gcloud.storage.Storage.BlobSourceOption;
import com.google.gcloud.storage.Storage.BlobTargetOption;
import com.google.gcloud.storage.Storage.BucketSourceOption;
import com.google.gcloud.storage.Storage.BucketTargetOption;

import java.util.LinkedList;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;

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

/**
* Construct a {@code Bucket} object for the provided {@code BucketInfo}. The storage service is
* Constructs a {@code Bucket} object for the provided {@code BucketInfo}. The storage service is
* used to issue requests.
*
* @param storage the storage service used for issuing requests
Expand All @@ -56,7 +55,7 @@ public Bucket(Storage storage, BucketInfo info) {
}

/**
* Construct a {@code Bucket} object for the provided name. The storage service is used to issue
* Constructs a {@code Bucket} object for the provided name. The storage service is used to issue
* requests.
*
* @param storage the storage service used for issuing requests
Expand All @@ -68,14 +67,14 @@ public Bucket(Storage storage, String bucket) {
}

/**
* Return the bucket's information.
* Returns the bucket's information.
*/
public BucketInfo info() {
return info;
}

/**
* Check if this bucket exists.
* Checks if this bucket exists.
*
* @return true if this bucket exists, false otherwise
* @throws StorageException upon failure
Expand All @@ -96,11 +95,11 @@ public Bucket reload(BucketSourceOption... options) {
}

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

/**
* Delete this bucket.
* Deletes this bucket.
*
* @param options bucket delete options
* @return true if bucket was deleted
Expand All @@ -124,7 +123,7 @@ public boolean delete(BucketSourceOption... options) {
}

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

/**
* Return the requested blob in this bucket or {@code null} if not found.
* Returns the requested blob in this bucket or {@code null} if not found.
*
* @param blob name of the requested blob
* @param options blob search options
Expand All @@ -145,7 +144,7 @@ public Blob get(String blob, BlobSourceOption... options) {
}

/**
* Return a list of requested blobs in this bucket. Blobs that do not exist are null.
* Returns a list of requested blobs in this bucket. Blobs that do not exist are null.
*
* @param blobNames names of the requested blobs
* @throws StorageException upon failure
Expand All @@ -155,7 +154,7 @@ public List<Blob> getAll(String... blobNames) {
for (String blobName : blobNames) {
batch.get(info.name(), blobName);
}
List<Blob> blobs = new LinkedList<>();
List<Blob> blobs = new ArrayList<>(blobNames.length);
BatchResponse response = storage.apply(batch.build());
for (BatchResponse.Result<BlobInfo> result : response.gets()) {
BlobInfo blobInfo = result.get();
Expand All @@ -165,7 +164,7 @@ public List<Blob> getAll(String... blobNames) {
}

/**
* Create a new blob in this bucket.
* Creates a new blob in this bucket.
*
* @param blob a blob name
* @param content the blob content
Expand All @@ -179,7 +178,7 @@ Blob create(String blob, byte[] content, BlobTargetOption... options) {
}

/**
* Return the bucket's {@code Storage} object used to issue requests.
* Returns the bucket's {@code Storage} object used to issue requests.
*/
public Storage storage() {
return storage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@
public interface ListResult<T> extends Iterable<T> {

/**
* Return the cursor for the nextPage or {@code null} if no more results.
* Returns the cursor for the nextPage or {@code null} if no more results.
*/
String nextPageCursor();

/**
* Return the results of the nextPage or {@code null} if no more result.
* Returns the results of the nextPage or {@code null} if no more result.
*/
ListResult<T> nextPage();

Expand Down

0 comments on commit fa7d7fc

Please sign in to comment.