public class StorageSnippets extends Object
Storage interface.| Constructor and Description |
|---|
StorageSnippets(com.google.cloud.storage.Storage storage) |
| Modifier and Type | Method and Description |
|---|---|
com.google.cloud.storage.Blob |
batch(String bucketName,
String blobName1,
String blobName2)
Example of using a batch request to delete, update and get a blob.
|
List<Boolean> |
batchDelete(String bucketName,
String blobName1,
String blobName2)
Example of deleting several blobs using a single batch request.
|
List<Boolean> |
batchDeleteIterable(String bucketName,
String blobName1,
String blobName2)
Example of deleting several blobs using a single batch request.
|
List<com.google.cloud.storage.Blob> |
batchGet(String bucketName,
String blobName1,
String blobName2)
Example of getting information on several blobs using a single batch request.
|
List<com.google.cloud.storage.Blob> |
batchGetIterable(String bucketName,
String blobName1,
String blobName2)
Example of getting information on several blobs using a single batch request.
|
List<com.google.cloud.storage.Blob> |
batchUpdate(String bucketName,
String blobName1,
String blobName2)
Example of updating information on several blobs using a single batch request.
|
List<com.google.cloud.storage.Blob> |
batchUpdateIterable(String bucketName,
String blobName1,
String blobName2)
Example of updating information on several blobs using a single batch request.
|
com.google.cloud.storage.Blob |
composeBlobs(String bucketName,
String blobName,
String sourceBlob1,
String sourceBlob2)
Example of composing two blobs.
|
com.google.cloud.storage.Blob |
copyBlob(String bucketName,
String blobName,
String copyBlobName)
Example of copying a blob.
|
com.google.cloud.storage.Blob |
copyBlobInChunks(String bucketName,
String blobName,
String copyBlobName)
Example of copying a blob in chunks.
|
com.google.cloud.storage.Blob |
createBlob(String bucketName,
String blobName)
Example of creating a blob with no content.
|
com.google.cloud.storage.Blob |
createBlobFromByteArray(String bucketName,
String blobName)
Example of creating a blob from a byte array.
|
com.google.cloud.storage.Blob |
createBlobFromInputStream(String bucketName,
String blobName)
Example of creating a blob from an input stream.
|
com.google.cloud.storage.Bucket |
createBucket(String bucketName)
Example of creating a bucket.
|
boolean |
deleteBlob(String bucketName,
String blobName)
Example of deleting a blob.
|
boolean |
deleteBlobFromIdWithGeneration(String bucketName,
String blobName,
long blobGeneration)
Example of deleting a blob, only if its generation matches a value, otherwise a
StorageException is thrown. |
boolean |
deleteBlobFromStringsWithGeneration(String bucketName,
String blobName,
long blobGeneration)
Example of deleting a blob, only if its generation matches a value, otherwise a
StorageException is thrown. |
boolean |
deleteBucketWithMetageneration(String bucketName,
long bucketMetageneration)
Example of deleting a bucket, only if its metageneration matches a value, otherwise a
StorageException is thrown. |
com.google.cloud.storage.Blob |
getBlobFromId(String bucketName,
String blobName)
Example of getting information on a blob.
|
com.google.cloud.storage.Blob |
getBlobFromIdWithMetageneration(String bucketName,
String blobName,
long blobMetageneration)
Example of getting information on a blob, only if its metageneration matches a value, otherwise
a
StorageException is thrown. |
com.google.cloud.storage.Blob |
getBlobFromStringsWithMetageneration(String bucketName,
String blobName,
long blobMetageneration)
Example of getting information on a blob, only if its metageneration matches a value, otherwise
a
StorageException is thrown. |
com.google.cloud.storage.Bucket |
getBucketWithMetageneration(String bucketName,
long bucketMetageneration)
Example of getting information on a bucket, only if its metageneration matches a value,
otherwise a
StorageException is thrown. |
Iterator<com.google.cloud.storage.Blob> |
listBlobsWithDirectoryAndPrefix(String bucketName,
String directory)
Example of listing buckets, specifying the page size and a name prefix.
|
Iterator<com.google.cloud.storage.Bucket> |
listBucketsWithSizeAndPrefix(String prefix)
Example of listing buckets, specifying the page size and a name prefix.
|
byte[] |
readBlobFromId(String bucketName,
String blobName,
long blobGeneration)
Example of reading all bytes of a blob's specific generation, otherwise a
StorageException is thrown. |
byte[] |
readBlobFromStringsWithGeneration(String bucketName,
String blobName,
long blobGeneration)
Example of reading all bytes of a blob, if generation matches a value, otherwise a
StorageException is thrown. |
void |
readerFromId(String bucketName,
String blobName)
Example of reading a blob's content through a reader.
|
void |
readerFromStrings(String bucketName,
String blobName)
Example of reading a blob's content through a reader.
|
URL |
signUrl(String bucketName,
String blobName)
Example of creating a signed URL that is valid for 2 weeks, using the default credentials for
signing the URL.
|
URL |
signUrlWithSigner(String bucketName,
String blobName,
String keyPath)
Example of creating a signed URL passing the
Storage.SignUrlOption.signWith(ServiceAccountSigner) option, that will be used for signing the
URL. |
com.google.cloud.storage.Blob |
updateBlob(String bucketName,
String blobName)
Example of replacing blob's metadata.
|
com.google.cloud.storage.Blob |
updateBlobWithMetageneration(String bucketName,
String blobName)
Example of udating a blob, only if the blob's metageneration matches a value, otherwise a
StorageException is thrown. |
com.google.cloud.storage.Bucket |
updateBucket(String bucketName)
Example of updating bucket information.
|
void |
writer(String bucketName,
String blobName)
Example of writing a blob's content through a writer.
|
public com.google.cloud.storage.Bucket createBucket(String bucketName)
public com.google.cloud.storage.Blob createBlob(String bucketName, String blobName)
public com.google.cloud.storage.Blob createBlobFromByteArray(String bucketName, String blobName)
public com.google.cloud.storage.Blob createBlobFromInputStream(String bucketName, String blobName)
public com.google.cloud.storage.Bucket getBucketWithMetageneration(String bucketName, long bucketMetageneration)
StorageException is thrown.public com.google.cloud.storage.Blob getBlobFromStringsWithMetageneration(String bucketName, String blobName, long blobMetageneration)
StorageException is thrown.public com.google.cloud.storage.Blob getBlobFromId(String bucketName, String blobName)
public com.google.cloud.storage.Blob getBlobFromIdWithMetageneration(String bucketName, String blobName, long blobMetageneration)
StorageException is thrown.public Iterator<com.google.cloud.storage.Bucket> listBucketsWithSizeAndPrefix(String prefix)
public Iterator<com.google.cloud.storage.Blob> listBlobsWithDirectoryAndPrefix(String bucketName, String directory)
public com.google.cloud.storage.Bucket updateBucket(String bucketName)
public com.google.cloud.storage.Blob updateBlob(String bucketName, String blobName)
public com.google.cloud.storage.Blob updateBlobWithMetageneration(String bucketName, String blobName)
StorageException is thrown.public boolean deleteBucketWithMetageneration(String bucketName, long bucketMetageneration)
StorageException is thrown.public boolean deleteBlobFromStringsWithGeneration(String bucketName, String blobName, long blobGeneration)
StorageException is thrown.public boolean deleteBlobFromIdWithGeneration(String bucketName, String blobName, long blobGeneration)
StorageException is thrown.public boolean deleteBlob(String bucketName, String blobName)
public com.google.cloud.storage.Blob composeBlobs(String bucketName, String blobName, String sourceBlob1, String sourceBlob2)
public com.google.cloud.storage.Blob copyBlob(String bucketName, String blobName, String copyBlobName)
public com.google.cloud.storage.Blob copyBlobInChunks(String bucketName, String blobName, String copyBlobName)
public byte[] readBlobFromStringsWithGeneration(String bucketName, String blobName, long blobGeneration)
StorageException is thrown.public byte[] readBlobFromId(String bucketName, String blobName, long blobGeneration)
StorageException is thrown.public com.google.cloud.storage.Blob batch(String bucketName, String blobName1, String blobName2)
public void readerFromStrings(String bucketName, String blobName) throws IOException
IOExceptionpublic void readerFromId(String bucketName, String blobName) throws IOException
IOExceptionpublic void writer(String bucketName, String blobName) throws IOException
IOExceptionpublic URL signUrl(String bucketName, String blobName)
public URL signUrlWithSigner(String bucketName, String blobName, String keyPath) throws IOException
Storage.SignUrlOption.signWith(ServiceAccountSigner) option, that will be used for signing the
URL.IOExceptionpublic List<com.google.cloud.storage.Blob> batchGet(String bucketName, String blobName1, String blobName2)
public List<com.google.cloud.storage.Blob> batchGetIterable(String bucketName, String blobName1, String blobName2)
public List<com.google.cloud.storage.Blob> batchUpdate(String bucketName, String blobName1, String blobName2)
public List<com.google.cloud.storage.Blob> batchUpdateIterable(String bucketName, String blobName1, String blobName2)
public List<Boolean> batchDelete(String bucketName, String blobName1, String blobName2)
Copyright © 2016 Google. All rights reserved.