public class BlobSnippets extends Object
Blob class.| Constructor and Description |
|---|
BlobSnippets(com.google.cloud.storage.Blob blob) |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
content()
Example of reading all bytes of the blob, if its generation matches the
BlobInfo.generation() value, otherwise a StorageException is thrown. |
com.google.cloud.storage.Blob |
copyToBucket(String bucketName)
Example of copying the blob to a different bucket, keeping the original name.
|
com.google.cloud.storage.Blob |
copyToId(String bucketName,
String blobName)
Example of copying the blob to a different bucket with a different name.
|
com.google.cloud.storage.Blob |
copyToStrings(String bucketName,
String blobName)
Example of copying the blob to a different bucket with a different name.
|
boolean |
delete()
Example of deleting the blob, if its generation matches the
BlobInfo.generation() value,
otherwise a StorageException is thrown. |
boolean |
exists()
Example of checking if the blob exists.
|
void |
reader()
Example of reading the blob's content through a reader.
|
com.google.cloud.storage.Blob |
reload()
Example of getting the blob's latest information, if its generation does not match the
BlobInfo.generation() value, otherwise a StorageException is thrown. |
URL |
signUrl()
Example of creating a signed URL for the blob that is valid for 2 weeks, using the default
credentials for signing the URL.
|
URL |
signUrlWithSigner(String keyPath)
Example of creating a signed URL for the blob passing the
Storage.SignUrlOption.signWith(ServiceAccountSigner) option, that will be used to sign the URL. |
com.google.cloud.storage.Blob |
update()
Example of replacing blob's metadata.
|
void |
writer()
Example of writing the blob's content through a writer.
|
public boolean exists()
public byte[] content()
BlobInfo.generation() value, otherwise a StorageException is thrown.public com.google.cloud.storage.Blob reload()
BlobInfo.generation() value, otherwise a StorageException is thrown.public com.google.cloud.storage.Blob update()
public boolean delete()
BlobInfo.generation() value,
otherwise a StorageException is thrown.public com.google.cloud.storage.Blob copyToId(String bucketName, String blobName)
public com.google.cloud.storage.Blob copyToBucket(String bucketName)
public com.google.cloud.storage.Blob copyToStrings(String bucketName, String blobName)
public void reader()
throws IOException
IOExceptionpublic void writer()
throws IOException
IOExceptionpublic URL signUrl()
public URL signUrlWithSigner(String keyPath) throws IOException
Storage.SignUrlOption.signWith(ServiceAccountSigner) option, that will be used to sign the URL.IOExceptionCopyright © 2016 Google. All rights reserved.