5454import java .util .Arrays ;
5555import java .util .HashMap ;
5656import java .util .Iterator ;
57- import java .util .LinkedList ;
5857import java .util .List ;
5958import java .util .Map ;
6059import java .util .concurrent .TimeUnit ;
@@ -182,9 +181,9 @@ private static class InfoAction extends BlobsAction {
182181 @ Override
183182 public void run (Storage storage , BlobId ... blobIds ) {
184183 if (blobIds .length == 1 ) {
185- if (blobIds [0 ].name ().isEmpty ()) {
184+ if (blobIds [0 ].getName ().isEmpty ()) {
186185 // get Bucket
187- Bucket bucket = storage .get (blobIds [0 ].bucket ());
186+ Bucket bucket = storage .get (blobIds [0 ].getBucket ());
188187 if (bucket == null ) {
189188 System .out .println ("No such bucket" );
190189 return ;
@@ -229,7 +228,8 @@ public String params() {
229228 * If more than one blob is supplied a Batch operation would be used to delete all requested
230229 * blobs in a single RPC.
231230 *
232- * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/delete">Objects: delete</a>
231+ * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/delete">
232+ * Objects: delete</a>
233233 */
234234 private static class DeleteAction extends BlobsAction {
235235 @ Override
@@ -296,7 +296,8 @@ public String params() {
296296 /**
297297 * This class demonstrates how to create a new Blob or to update its content.
298298 *
299- * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/insert">Objects: insert</a>
299+ * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/insert">
300+ * Objects: insert</a>
300301 */
301302 private static class UploadAction extends StorageAction <Tuple <Path , BlobInfo >> {
302303 @ Override
@@ -337,7 +338,7 @@ Tuple<Path, BlobInfo> parse(String... args) throws IOException {
337338 Path path = Paths .get (args [0 ]);
338339 String contentType = Files .probeContentType (path );
339340 String blob = args .length < 3 ? path .getFileName ().toString () : args [2 ];
340- return Tuple .of (path , BlobInfo .builder (args [1 ], blob ).contentType (contentType ).build ());
341+ return Tuple .of (path , BlobInfo .newBuilder (args [1 ], blob ).setContentType (contentType ).build ());
341342 }
342343
343344 @ Override
@@ -370,9 +371,9 @@ private void run(Storage storage, BlobId blobId, Path downloadTo) throws IOExcep
370371 if (downloadTo != null ) {
371372 writeTo = new PrintStream (new FileOutputStream (downloadTo .toFile ()));
372373 }
373- if (blob .size () < 1_000_000 ) {
374+ if (blob .getSize () < 1_000_000 ) {
374375 // Blob is small read all its content in one request
375- byte [] content = blob .content ();
376+ byte [] content = blob .getContent ();
376377 writeTo .write (content );
377378 } else {
378379 // When Blob size is big or unknown use the blob's channel reader.
@@ -425,7 +426,7 @@ private static class CopyAction extends StorageAction<CopyRequest> {
425426 @ Override
426427 public void run (Storage storage , CopyRequest request ) {
427428 CopyWriter copyWriter = storage .copy (request );
428- System .out .printf ("Copied %s%n" , copyWriter .result ());
429+ System .out .printf ("Copied %s%n" , copyWriter .getResult ());
429430 }
430431
431432 @ Override
@@ -445,7 +446,8 @@ public String params() {
445446 /**
446447 * This class demonstrates how to use the compose command.
447448 *
448- * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/compose">Objects: compose</a>
449+ * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/compose">
450+ * Objects: compose</a>
449451 */
450452 private static class ComposeAction extends StorageAction <ComposeRequest > {
451453 @ Override
@@ -459,8 +461,8 @@ ComposeRequest parse(String... args) {
459461 if (args .length < 3 ) {
460462 throw new IllegalArgumentException ();
461463 }
462- ComposeRequest .Builder request = ComposeRequest .builder ();
463- request .target (BlobInfo .builder (args [0 ], args [args .length - 1 ]).build ());
464+ ComposeRequest .Builder request = ComposeRequest .newBuilder ();
465+ request .setTarget (BlobInfo .newBuilder (args [0 ], args [args .length - 1 ]).build ());
464466 for (int i = 1 ; i < args .length - 1 ; i ++) {
465467 request .addSource (args [i ]);
466468 }
@@ -476,7 +478,8 @@ public String params() {
476478 /**
477479 * This class demonstrates how to update a blob's metadata.
478480 *
479- * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/update">Objects: update</a>
481+ * @see <a href="https://cloud.google.com/storage/docs/json_api/v1/objects/update">
482+ * Objects: update</a>
480483 */
481484 private static class UpdateMetadataAction extends
482485 StorageAction <Tuple <BlobId , Map <String , String >>> {
@@ -493,7 +496,7 @@ private void run(Storage storage, BlobId blobId, Map<String, String> metadata) {
493496 System .out .println ("No such object" );
494497 return ;
495498 }
496- Blob updateBlob = blob .toBuilder ().metadata (metadata ).build ().update ();
499+ Blob updateBlob = blob .toBuilder ().setMetadata (metadata ).build ().update ();
497500 System .out .printf ("Updated %s%n" , updateBlob );
498501 }
499502
@@ -539,7 +542,7 @@ public void run(Storage storage, Tuple<ServiceAccountAuthCredentials, BlobInfo>
539542 }
540543
541544 private void run (Storage storage , ServiceAccountAuthCredentials cred , BlobInfo blobInfo ) {
542- Blob blob = storage .get (blobInfo .blobId ());
545+ Blob blob = storage .get (blobInfo .getBlobId ());
543546 System .out .printf ("Signed URL: %s%n" ,
544547 blob .signUrl (1 , TimeUnit .DAYS , SignUrlOption .signWith (cred )));
545548 }
@@ -555,7 +558,7 @@ Tuple<ServiceAccountAuthCredentials, BlobInfo> parse(String... args) throws IOEx
555558 keystore .load (Files .newInputStream (Paths .get (args [0 ])), PASSWORD );
556559 PrivateKey privateKey = (PrivateKey ) keystore .getKey ("privatekey" , PASSWORD );
557560 ServiceAccountAuthCredentials cred = AuthCredentials .createFor (args [1 ], privateKey );
558- return Tuple .of (cred , BlobInfo .builder (BlobId .of (args [2 ], args [3 ])).build ());
561+ return Tuple .of (cred , BlobInfo .newBuilder (BlobId .of (args [2 ], args [3 ])).build ());
559562 }
560563
561564 @ Override
@@ -576,14 +579,14 @@ private abstract static class AclAction extends StorageAction<Tuple<BlobId, Acl>
576579 public void run (Storage storage , Tuple <BlobId , Acl > params ) {
577580 BlobId blobId = params .x ();
578581 Acl acl = params .y ();
579- if (blobId .name ().isEmpty ()) {
580- Bucket bucket = storage .get (blobId .bucket ());
582+ if (blobId .getName ().isEmpty ()) {
583+ Bucket bucket = storage .get (blobId .getBucket ());
581584 if (bucket == null ) {
582- System .out .printf ("Bucket %s does not exist%n" , blobId .bucket ());
585+ System .out .printf ("Bucket %s does not exist%n" , blobId .getBucket ());
583586 return ;
584587 }
585588 acl = bucket .createAcl (acl );
586- System .out .printf ("Added ACL %s to bucket %s%n" , acl , blobId .bucket ());
589+ System .out .printf ("Added ACL %s to bucket %s%n" , acl , blobId .getBucket ());
587590 } else {
588591 Blob blob = storage .get (blobId );
589592 if (blob == null ) {
0 commit comments