Class BlobInfo

java.lang.Object
com.google.cloud.storage.BlobInfo
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
Blob

@TransportCompatibility({HTTP,GRPC}) public class BlobInfo extends Object implements Serializable
Information about an object in Google Cloud Storage. A 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: