File tree Expand file tree Collapse file tree
google-cloud-storage/src/main/java/com/google/cloud/storage Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5252import java .util .concurrent .TimeUnit ;
5353
5454/**
55- * A Google cloud storage object.
55+ * An object in Google Cloud Storage. A {@code Blob} object includes the {@code BlobId} instance,
56+ * the set of properties inherited from the {@link BlobInfo} class and the {@code Storage} instance.
57+ * The class provides methods to perform operations on the object. Reading a property value does not
58+ * issue any RPC calls. The object content is not stored within the {@code Blob} instance.
59+ * Operations that access the content issue one or multiple RPC calls, depending on the content
60+ * size.
5661 *
5762 * <p>Objects of this class are immutable. Operations that modify the blob like {@link #update} and
58- * {@link #copyTo} return a new object. To get a {@code Blob} object with the most recent
59- * information use {@link #reload}. {@code Blob} adds a layer of service-related functionality over
60- * {@link BlobInfo}.
63+ * {@link #copyTo} return a new object. Any changes to the object in Google Cloud Storage made after
64+ * creation of the {@code Blob} are not visible in the {@code Blob}. To get a {@code Blob} object
65+ * with the most recent information use {@link #reload}.
66+ *
67+ * <p>Example of getting the content of the object in Google Cloud Storage:
68+ *
69+ * <pre>{@code
70+ * BlobId blobId = BlobId.of(bucketName, blobName);
71+ * Blob blob = storage.get(blobId);
72+ * long size = blob.getSize(); // no RPC call is required
73+ * byte[] content = blob.getContent(); // one or multiple RPC calls will be issued
74+ * }</pre>
6175 */
6276public class Blob extends BlobInfo {
6377
Original file line number Diff line number Diff line change 4444import java .util .Set ;
4545
4646/**
47- * Google Storage object metadata.
47+ * Information about an object in Google Cloud Storage. A {@code BlobInfo} object includes the
48+ * {@code BlobId} instance and the set of properties, such as the blob's access control
49+ * configuration, user provided metadata, the CRC32C checksum, etc. Instances of this class are used
50+ * to create a new object in Google Cloud Storage or update the properties of an existing object. To
51+ * deal with existing Storage objects the API includes the {@link Blob} class which extends {@code
52+ * BlobInfo} and declares methods to perform operations on the object. Neither {@code BlobInfo} nor
53+ * {@code Blob} instances keep the object content, just the object properties.
54+ *
55+ * <p>Example of usage {@code BlobInfo} to create an object in Google Cloud Storage:
56+ *
57+ * <pre>{@code
58+ * BlobId blobId = BlobId.of(bucketName, blobName);
59+ * BlobInfo blobInfo = BlobInfo.newBuilder(blobId).setContentType("text/plain").build();
60+ * Blob blob = storage.create(blobInfo, "Hello, world".getBytes(StandardCharsets.UTF_8));
61+ * }</pre>
4862 *
4963 * @see <a href="https://cloud.google.com/storage/docs/concepts-techniques#concepts">Concepts and
5064 * Terminology</a>
You can’t perform that action at this time.
0 commit comments