File tree 2 files changed +33
-5
lines changed
google-cloud-storage/src/main/java/com/google/cloud/storage
2 files changed +33
-5
lines changed Original file line number Diff line number Diff line change 52
52
import java .util .concurrent .TimeUnit ;
53
53
54
54
/**
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.
56
61
*
57
62
* <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>
61
75
*/
62
76
public class Blob extends BlobInfo {
63
77
Original file line number Diff line number Diff line change 44
44
import java .util .Set ;
45
45
46
46
/**
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>
48
62
*
49
63
* @see <a href="https://cloud.google.com/storage/docs/concepts-techniques#concepts">Concepts and
50
64
* Terminology</a>
You can’t perform that action at this time.
0 commit comments