Class BlobInfo
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
Blob
BlobInfo
object includes the
BlobId
instance and the set of properties, such as the blob's access control
configuration, user provided metadata, the CRC32C checksum, etc. Instances of this class are used
to create a new object in Google Cloud Storage or update the properties of an existing object. To
deal with existing Storage objects the API includes the Blob
class which extends
BlobInfo
and declares methods to perform operations on the object. Neither BlobInfo
nor
Blob
instances keep the object content, just the object properties.
Example of usage BlobInfo
to create an object in Google Cloud Storage:
BlobId blobId = BlobId.of(bucketName, blobName);
BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
Blob blob = storage.create(blobInfo, "Hello, world".getBytes(StandardCharsets.UTF_8));
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Builder forBlobInfo
.static class
Objects of this class hold information on the customer-supplied encryption key, if the blob is encrypted using such a key.static final class
This class is meant for internal use only. -
Method Summary
Modifier and TypeMethodDescriptionboolean
getAcl()
Returns the blob's access control configuration.Returns the blob's identity.Returns the name of the containing bucket.Returns the blob's data cache control.Returns the number of components that make up this blob.Returns the blob's data content disposition.Returns the blob's data content encoding.Returns the blob's data content language.Returns the blob's data content type.Returns the CRC32C checksum of blob's data as described in RFC 4960, Appendix B; encoded in base64 in big-endian order.Returns the CRC32C checksum of blob's data as described in RFC 4960, Appendix B; decoded to string.Deprecated.Returns the creation time of the blob.Returns information on the customer-supplied encryption key, if the blob is encrypted using such a key.Deprecated.Returns the custom time specified by the user for an object.Deprecated.Returns the deletion time of the blob.getEtag()
Returns HTTP 1.1 Entity tag for the blob.Returns aBoolean
with eithertrue
,null
and in certain casesfalse
.Returns the service-generated for the blob.Returns blob's data generation.Returns the Cloud KMS key used to encrypt the blob, if any.getMd5()
Returns the MD5 hash of blob's data encoded in base64.Returns the MD5 hash of blob's data decoded to string.Returns the blob's media download link.Returns blob's user provided metadata.Returns blob's metageneration.getName()
Returns the blob's name.getOwner()
Returns the blob's owner.Deprecated.Returns the retention expiration time of the blob, if a retention period is defined.Returns the URI of this blob as a string.getSize()
Returns the content length of the data in bytes.Returns the storage class of the blob.Returns aBoolean
with eithertrue
,null
and in certain casesfalse
.Deprecated.Returns the time that the object's storage class was last changed or the time of the object creation.Deprecated.Returns the last modification time of the blob's metadata.int
hashCode()
boolean
Returnstrue
if the current blob represents a directory.static BlobInfo.Builder
newBuilder
(BlobId blobId) Returns aBlobInfo
builder where blob identity is set using the provided value.static BlobInfo.Builder
newBuilder
(BucketInfo bucketInfo, String name) Returns aBlobInfo
builder where blob identity is set using the provided values.static BlobInfo.Builder
newBuilder
(BucketInfo bucketInfo, String name, Long generation) Returns aBlobInfo
builder where blob identity is set using the provided values.static BlobInfo.Builder
newBuilder
(String bucket, String name) Returns aBlobInfo
builder where blob identity is set using the provided values.static BlobInfo.Builder
newBuilder
(String bucket, String name, Long generation) Returns aBlobInfo
builder where blob identity is set using the provided values.Returns a builder for the current blob.toString()
-
Method Details
-
getBlobId
Returns the blob's identity. -
getBucket
Returns the name of the containing bucket. -
getGeneratedId
Returns the service-generated for the blob. -
getName
Returns the blob's name. -
getCacheControl
Returns the blob's data cache control.- See Also:
-
getAcl
Returns the blob's access control configuration.- See Also:
-
getOwner
Returns the blob's owner. This will always be the uploader of the blob. -
getSize
Returns the content length of the data in bytes.- See Also:
-
getContentType
Returns the blob's data content type.- See Also:
-
getContentEncoding
Returns the blob's data content encoding.- See Also:
-
getContentDisposition
Returns the blob's data content disposition.- See Also:
-
getContentLanguage
Returns the blob's data content language.- See Also:
-
getComponentCount
Returns the number of components that make up this blob. Components are accumulated through theStorage.compose(Storage.ComposeRequest)
operation and are limited to a count of 1024, counting 1 for each non-composite component blob and componentCount for each composite component blob. This value is set only for composite blobs.- See Also:
-
getEtag
Returns HTTP 1.1 Entity tag for the blob.- See Also:
-
getSelfLink
Returns the URI of this blob as a string. -
getMd5
Returns the MD5 hash of blob's data encoded in base64.- See Also:
-
getMd5ToHexString
Returns the MD5 hash of blob's data decoded to string.- See Also:
-
getCrc32c
Returns the CRC32C checksum of blob's data as described in RFC 4960, Appendix B; encoded in base64 in big-endian order.- See Also:
-
getCrc32cToHexString
Returns the CRC32C checksum of blob's data as described in RFC 4960, Appendix B; decoded to string.- See Also:
-
getMediaLink
Returns the blob's media download link. -
getMetadata
Returns blob's user provided metadata. -
getGeneration
Returns blob's data generation. Used for blob versioning. -
getMetageneration
Returns blob's metageneration. Used for preconditions and for detecting changes in metadata. A metageneration number is only meaningful in the context of a particular generation of a particular blob. -
getDeleteTime
Deprecated.Returns the deletion time of the blob expressed as the number of milliseconds since the Unix epoch. -
getDeleteTimeOffsetDateTime
Returns the deletion time of the blob. -
getUpdateTime
Deprecated.Returns the last modification time of the blob's metadata expressed as the number of milliseconds since the Unix epoch. -
getUpdateTimeOffsetDateTime
Returns the last modification time of the blob's metadata. -
getCreateTime
Deprecated.Returns the creation time of the blob expressed as the number of milliseconds since the Unix epoch. -
getCreateTimeOffsetDateTime
Returns the creation time of the blob. -
getCustomTime
Deprecated.Returns the custom time specified by the user for an object. -
getCustomTimeOffsetDateTime
Returns the custom time specified by the user for an object. -
isDirectory
public boolean isDirectory()Returnstrue
if the current blob represents a directory. This can only happen if the blob is returned byStorage.list(String, Storage.BlobListOption...)
when theStorage.BlobListOption.currentDirectory()
option is used. When this is the case onlygetBlobId()
andgetSize()
are set for the current blob:BlobId.getName()
ends with the '/' character,BlobId.getGeneration()
returnsnull
andgetSize()
is0
. -
getCustomerEncryption
Returns information on the customer-supplied encryption key, if the blob is encrypted using such a key. -
getStorageClass
Returns the storage class of the blob. -
getTimeStorageClassUpdated
Deprecated.Returns the time that the object's storage class was last changed or the time of the object creation. -
getTimeStorageClassUpdatedOffsetDateTime
Returns the time that the object's storage class was last changed or the time of the object creation. -
getKmsKeyName
Returns the Cloud KMS key used to encrypt the blob, if any. -
getEventBasedHold
Returns aBoolean
with eithertrue
,null
and in certain casesfalse
.Case 1:
true
the fieldStorage.BlobField.EVENT_BASED_HOLD
is selected in aStorage.get(BlobId, Storage.BlobGetOption...)
and event-based hold for the blob is enabled.Case 2.1:
null
the fieldStorage.BlobField.EVENT_BASED_HOLD
is selected in aStorage.get(BlobId, Storage.BlobGetOption...)
, but event-based hold for the blob is not enabled. This case can be considered implicitlyfalse
.Case 2.2:
null
the fieldStorage.BlobField.EVENT_BASED_HOLD
is not selected in aStorage.get(BlobId, Storage.BlobGetOption...)
, and the state for this field is unknown.Case 3:
false
event-based hold is explicitly set to false using in aBlobInfo.Builder.setEventBasedHold(Boolean)
client side for a follow-up request e.g.Storage.update(BlobInfo, Storage.BlobTargetOption...)
in which case the value of event-based hold will remainfalse
for the given instance. -
getTemporaryHold
Returns aBoolean
with eithertrue
,null
and in certain casesfalse
.Case 1:
true
the fieldStorage.BlobField.TEMPORARY_HOLD
is selected in aStorage.get(BlobId, Storage.BlobGetOption...)
and temporary hold for the blob is enabled.Case 2.1:
null
the fieldStorage.BlobField.TEMPORARY_HOLD
is selected in aStorage.get(BlobId, Storage.BlobGetOption...)
, but temporary hold for the blob is not enabled. This case can be considered implicitlyfalse
.Case 2.2:
null
the fieldStorage.BlobField.TEMPORARY_HOLD
is not selected in aStorage.get(BlobId, Storage.BlobGetOption...)
, and the state for this field is unknown.Case 3:
false
event-based hold is explicitly set to false using in aBlobInfo.Builder.setEventBasedHold(Boolean)
client side for a follow-up request e.g.Storage.update(BlobInfo, Storage.BlobTargetOption...)
in which case the value of temporary hold will remainfalse
for the given instance. -
getRetentionExpirationTime
Deprecated.Returns the retention expiration time of the blob asLong
, if a retention period is defined. If retention period is not defined this value returnsnull
-
getRetentionExpirationTimeOffsetDateTime
Returns the retention expiration time of the blob, if a retention period is defined. If retention period is not defined this value returnsnull
-
toBuilder
Returns a builder for the current blob. -
toString
-
hashCode
public int hashCode() -
equals
-
newBuilder
Returns aBlobInfo
builder where blob identity is set using the provided values. -
newBuilder
Returns aBlobInfo
builder where blob identity is set using the provided values. -
newBuilder
Returns aBlobInfo
builder where blob identity is set using the provided values. -
newBuilder
Returns aBlobInfo
builder where blob identity is set using the provided values. -
newBuilder
Returns aBlobInfo
builder where blob identity is set using the provided value.
-
getCreateTimeOffsetDateTime()