Skip to content

Commit 38f6d31

Browse files
committed
Add new storage snippets to javadoc
1 parent 86dc4c4 commit 38f6d31

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

+12
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,18 @@ public CopyWriter copyTo(String targetBucket, String targetBlob, BlobSourceOptio
617617
* }
618618
* }</pre>
619619
*
620+
* <p>Example of reading just a portion of the blob's content.
621+
* <pre> {@code
622+
* int start = 1;
623+
* int end = 8;
624+
* try (ReadChannel reader = blob.reader()) {
625+
* reader.seek(start);
626+
* ByteBuffer bytes = ByteBuffer.allocate(end - start);
627+
* reader.read(bytes);
628+
* return bytes.array();
629+
* }
630+
* }</pre>
631+
*
620632
* @param options blob read options
621633
* @throws StorageException upon failure
622634
*/

google-cloud-storage/src/main/java/com/google/cloud/storage/Storage.java

+11
Original file line numberDiff line numberDiff line change
@@ -1496,6 +1496,17 @@ public static Builder newBuilder() {
14961496
* Bucket bucket = storage.create(BucketInfo.of(bucketName));
14971497
* }</pre>
14981498
*
1499+
* <p>Example of creating a bucket with storage class and location.
1500+
* <pre> {@code
1501+
* String bucketName = "my_unique_bucket";
1502+
* Bucket bucket = storage.create(BucketInfo.newBuilder(bucketName)
1503+
* // See here for possible values: http://g.co/cloud/storage/docs/storage-classes
1504+
* .setStorageClass("COLDLINE")
1505+
* // Possible values: http://g.co/cloud/storage/docs/bucket-locations#location-mr
1506+
* .setLocation("asia")
1507+
* .build());
1508+
* }</pre>
1509+
*
14991510
* @return a complete bucket
15001511
* @throws StorageException upon failure
15011512
*/

0 commit comments

Comments
 (0)