Package com.google.cloud.hadoop.gcsio
Class GoogleCloudStorageItemInfo
- java.lang.Object
-
- com.google.cloud.hadoop.gcsio.GoogleCloudStorageItemInfo
-
public class GoogleCloudStorageItemInfo extends Object
Contains information about an item in Google Cloud Storage.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceGoogleCloudStorageItemInfo.ProviderConvenience interface for classes which want to implement Provider of GoogleCloudStorageItemInfo for callers which may not know the concrete type of an object, but want to check if the object happens to be an instance of this InfoProvider.
-
Field Summary
Fields Modifier and Type Field Description static GoogleCloudStorageItemInfoROOT_INFO
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static GoogleCloudStorageItemInfocreateBucket(StorageResourceId resourceId, long creationTime, long modificationTime, String location, String storageClass)Factory method for creating a GoogleCloudStorageItemInfo for a bucket.static GoogleCloudStorageItemInfocreateFolder(StorageResourceId resourceId, com.google.storage.control.v2.Folder folder)Factory method for creating a GoogleCloudStorageItemInfo from a native HNS Folder.static GoogleCloudStorageItemInfocreateInferredDirectory(StorageResourceId resourceId)Factory method for creating a "found" GoogleCloudStorageItemInfo for an inferred directory.static GoogleCloudStorageItemInfocreateNotFound(StorageResourceId resourceId)Factory method for creating a "not found" GoogleCloudStorageItemInfo for a bucket or an object.static GoogleCloudStorageItemInfocreateObject(StorageResourceId resourceId, long creationTime, long modificationTime, long size, String contentType, String contentEncoding, Map<String,byte[]> metadata, long contentGeneration, long metaGeneration, VerificationAttributes verificationAttributes)Factory method for creating a GoogleCloudStorageItemInfo for an object.booleanequals(Object obj)booleanexists()Indicates whether this item exists.StringgetBucketName()Gets bucket name of this item.StringgetContentEncoding()Gets the content-encoding of this item, or null if unknown or inapplicable.longgetContentGeneration()Get the content generation of the object.StringgetContentType()Gets the content-type of this item, or null if unknown or inapplicable.longgetCreationTime()Gets creation time of this item.StringgetLocation()Gets location of this item.Map<String,byte[]>getMetadata()Gets user-supplied metadata for this item.longgetMetaGeneration()Get the meta generation of the object.longgetModificationTime()Gets modification time of this item.StringgetObjectName()Gets object name of this item.StorageResourceIdgetResourceId()Gets the resourceId that holds the (possibly null) bucketName and objectName of this object.longgetSize()Gets size of this item (number of bytes).StringgetStorageClass()Gets storage class of this item.VerificationAttributesgetVerificationAttributes()Get object validation attributes.inthashCode()booleanisBucket()Indicates whether this item is a bucket.booleanisDirectory()Indicates whetheritemInfois a directory.booleanisGlobalRoot()Indicates whether this instance has information about the unique, shared root of the underlying storage system.booleanisInferredDirectory()Indicates whetheritemInfois an inferred directorybooleanisNativeHNSFolder()Indicates whetheritemInfois a native HNS folder.booleanisRoot()Indicates whether this item refers to the GCS root (gs://).booleanmetadataEquals(Map<String,byte[]> otherMetadata)Helper for checking logical equality of metadata maps, checking equality of keySet() between this.metadata and otherMetadata, and then using Arrays.equals to compare contents of corresponding byte arrays.StringtoString()Gets string representation of this instance.
-
-
-
Field Detail
-
ROOT_INFO
public static final GoogleCloudStorageItemInfo ROOT_INFO
-
-
Method Detail
-
createBucket
public static GoogleCloudStorageItemInfo createBucket(StorageResourceId resourceId, long creationTime, long modificationTime, String location, String storageClass)
Factory method for creating a GoogleCloudStorageItemInfo for a bucket.- Parameters:
resourceId- Resource ID that identifies a bucketcreationTime- Time when a bucket was created (milliseconds since January 1, 1970 UTC).modificationTime- Time when a bucket was last modified (milliseconds since January 1, 1970 UTC).location- Location of a bucket.storageClass- Storage class of a bucket.
-
createObject
public static GoogleCloudStorageItemInfo createObject(StorageResourceId resourceId, long creationTime, long modificationTime, long size, String contentType, String contentEncoding, Map<String,byte[]> metadata, long contentGeneration, long metaGeneration, VerificationAttributes verificationAttributes)
Factory method for creating a GoogleCloudStorageItemInfo for an object.- Parameters:
resourceId- identifies either root, a Bucket, or a StorageObjectcreationTime- Time when object was created (milliseconds since January 1, 1970 UTC).size- Size of the given object (number of bytes) or -1 if the object does not exist.metadata- User-supplied object metadata for this object.
-
createFolder
public static GoogleCloudStorageItemInfo createFolder(StorageResourceId resourceId, com.google.storage.control.v2.Folder folder)
Factory method for creating a GoogleCloudStorageItemInfo from a native HNS Folder.- Parameters:
resourceId- The resource ID of the folder.folder- The Folder object from the Storage Control API.
-
createInferredDirectory
public static GoogleCloudStorageItemInfo createInferredDirectory(StorageResourceId resourceId)
Factory method for creating a "found" GoogleCloudStorageItemInfo for an inferred directory.- Parameters:
resourceId- Resource ID that identifies an inferred directory
-
createNotFound
public static GoogleCloudStorageItemInfo createNotFound(StorageResourceId resourceId)
Factory method for creating a "not found" GoogleCloudStorageItemInfo for a bucket or an object.- Parameters:
resourceId- Resource ID that identifies an inferred directory
-
getBucketName
public String getBucketName()
Gets bucket name of this item.
-
getObjectName
public String getObjectName()
Gets object name of this item.
-
getResourceId
public StorageResourceId getResourceId()
Gets the resourceId that holds the (possibly null) bucketName and objectName of this object.
-
getCreationTime
public long getCreationTime()
Gets creation time of this item.Time is expressed as milliseconds since January 1, 1970 UTC.
-
getModificationTime
public long getModificationTime()
Gets modification time of this item.Time is expressed as milliseconds since January 1, 1970 UTC.
-
getSize
public long getSize()
Gets size of this item (number of bytes). Returns -1 if the object does not exist.
-
getLocation
public String getLocation()
Gets location of this item.Note: Location is only supported for buckets. The value is always null for objects.
-
getStorageClass
public String getStorageClass()
Gets storage class of this item.Note: Storage-class is only supported for buckets. The value is always null for objects.
-
getContentType
public String getContentType()
Gets the content-type of this item, or null if unknown or inapplicable.Note: content-type is only supported for objects, and will always be null for buckets.
-
getContentEncoding
public String getContentEncoding()
Gets the content-encoding of this item, or null if unknown or inapplicable.Note: content-encoding is only supported for objects, and will always be null for buckets.
-
getMetadata
public Map<String,byte[]> getMetadata()
Gets user-supplied metadata for this item.Note: metadata is only supported for objects. This value is always an empty map for buckets.
-
isBucket
public boolean isBucket()
Indicates whether this item is a bucket. Root is not considered to be a bucket.
-
isRoot
public boolean isRoot()
Indicates whether this item refers to the GCS root (gs://).
-
isGlobalRoot
public boolean isGlobalRoot()
Indicates whether this instance has information about the unique, shared root of the underlying storage system.
-
isNativeHNSFolder
public boolean isNativeHNSFolder()
Indicates whetheritemInfois a native HNS folder. This is different from a placeholder object or an inferred directory.
-
isDirectory
public boolean isDirectory()
Indicates whetheritemInfois a directory.
-
isInferredDirectory
public boolean isInferredDirectory()
Indicates whetheritemInfois an inferred directory
-
getContentGeneration
public long getContentGeneration()
Get the content generation of the object.
-
getMetaGeneration
public long getMetaGeneration()
Get the meta generation of the object.
-
getVerificationAttributes
public VerificationAttributes getVerificationAttributes()
Get object validation attributes.
-
exists
public boolean exists()
Indicates whether this item exists.
-
metadataEquals
public boolean metadataEquals(Map<String,byte[]> otherMetadata)
Helper for checking logical equality of metadata maps, checking equality of keySet() between this.metadata and otherMetadata, and then using Arrays.equals to compare contents of corresponding byte arrays.
-
toString
public String toString()
Gets string representation of this instance.
-
-