Class BlobId

java.lang.Object
com.google.cloud.storage.BlobId
All Implemented Interfaces:
Serializable

public final class BlobId extends Object implements Serializable
Google Storage Object identifier. A BlobId object includes the name of the containing bucket, the blob's name and possibly the blob's generation. If getGeneration() is null the identifier refers to the latest blob's generation.
See Also:
  • Method Details

    • getBucket

      public String getBucket()
      Returns the name of the bucket containing the blob.
    • getName

      public String getName()
      Returns the name of the blob.
    • getGeneration

      public Long getGeneration()
      Returns blob's data generation. Used for versioning.
    • toGsUtilUri

      public String toGsUtilUri()
      Returns this blob's Storage url which can be used with gsutil. If generation is non-null it will not be included in the uri.
    • toGsUtilUriWithGeneration

      public String toGsUtilUriWithGeneration()
      Returns this blob's Storage url which can be used with gsutil. If generation is non-null it will be included in the uri
      Since:
      2.22.1
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • of

      public static BlobId of(String bucket, String name)
      Creates a blob identifier. Generation is set to null.
      Parameters:
      bucket - the name of the bucket that contains the blob
      name - the name of the blob
    • of

      public static BlobId of(String bucket, String name, Long generation)
      Creates a BlobId object.
      Parameters:
      bucket - name of the containing bucket
      name - blob's name
      generation - blob's data generation, used for versioning. If null the identifier refers to the latest blob's generation
    • fromGsUtilUri

      public static BlobId fromGsUtilUri(String gsUtilUri)
      Creates a BlobId object.
      Parameters:
      gsUtilUri - the Storage url to create the blob from