public class StorageResourceId extends Object
| Modifier and Type | Field and Description |
|---|---|
static StorageResourceId |
ROOT |
| Constructor and Description |
|---|
StorageResourceId(String bucketName)
Constructor for a StorageResourceId representing a Bucket;
getObjectName() will return
null for a StorageResourceId which represents a Bucket. |
StorageResourceId(String bucketName,
String objectName)
Constructor for a StorageResourceId representing a full StorageObject, including bucketName
and objectName.
|
| Modifier and Type | Method and Description |
|---|---|
static String |
createReadableString(String bucketName,
String objectName)
Helper for standardizing the way various human-readable messages in logs/exceptions which refer
to a bucket/object pair.
|
boolean |
equals(Object obj) |
String |
getBucketName()
Gets the bucket name component of this resource identifier.
|
String |
getObjectName()
Gets the object name component of this resource identifier.
|
int |
hashCode() |
boolean |
isBucket()
Returns true if this StorageResourceId represents a GCS Bucket; if true, then
getObjectName will return null. |
boolean |
isDirectory()
Indicates if this StorageResourceId corresponds to a 'directory'; similar to
FileInfo.isDirectory() except deals entirely with pathnames instead of also checking
for exists() to be true on a corresponding GoogleCloudStorageItemInfo. |
boolean |
isRoot()
Returns true if this StorageResourceId represents the GCS root (gs://); if true, then
both
getBucketName and getObjectName will be null. |
boolean |
isStorageObject()
Returns true if this StorageResourceId represents a GCS StorageObject; if true, both
getBucketName and getObjectName will be non-empty and non-null. |
String |
toString()
Returns a string of the form gs://
|
public static final StorageResourceId ROOT
public StorageResourceId(String bucketName)
getObjectName() will return
null for a StorageResourceId which represents a Bucket.bucketName - The bucket name of the resource. Must be non-empty and non-null.public StorageResourceId(String bucketName, String objectName)
bucketName - The bucket name of the resource. Must be non-empty and non-null.objectName - The object name of the resource. Must be non-empty and non-null.public boolean isStorageObject()
getBucketName and getObjectName will be non-empty and non-null.public boolean isBucket()
getObjectName will return null.public boolean isRoot()
getBucketName and getObjectName will be null.public boolean isDirectory()
FileInfo.isDirectory() except deals entirely with pathnames instead of also checking
for exists() to be true on a corresponding GoogleCloudStorageItemInfo.public String getBucketName()
public String getObjectName()
public String toString()
Copyright © 2015. All rights reserved.