Package com.google.cloud.hadoop.gcsio
Class FileInfo
- java.lang.Object
-
- com.google.cloud.hadoop.gcsio.FileInfo
-
public class FileInfo extends Object
Contains information about a file or a directory.Note: This class wraps GoogleCloudStorageItemInfo, adds file system specific information and hides bucket/object specific information. The wrapped type should not be visible to callers of GoogleCloudStorageFileSystem because it exposes non-file system information (eg, buckets).
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)booleanexists()Indicates whether this file or directory exists.static FileInfofromItemInfo(GoogleCloudStorageItemInfo itemInfo)Handy factory method for constructing a FileInfo from a GoogleCloudStorageItemInfo while potentially returning a singleton instead of really constructing an object for cases like ROOT.static List<FileInfo>fromItemInfos(List<GoogleCloudStorageItemInfo> itemInfos)Handy factory method for constructing a list of FileInfo from a list of GoogleCloudStorageItemInfo.Map<String,byte[]>getAttributes()Retrieve file attributes for this file.byte[]getCrc32cChecksum()Returns CRC32C checksum of the file ornull.longgetCreationTime()Gets creation time of this item.byte[]getMd5Checksum()Returns MD5 checksum of the file ornull.longgetModificationTime()Gets the modification time of this file if one is set, otherwise the value ofgetCreationTime()is returned.URIgetPath()Gets the path of this file or directory.longgetSize()Gets the size of this file or directory.inthashCode()booleanisDirectory()Indicates whether this item is a directory.booleanisGlobalRoot()Indicates whether this instance has information about the unique, shared root of the underlying storage system.booleanisInferredDirectory()Indicates whether this item is an inferred directory.StringtoString()Gets string representation of this instance.
-
-
-
Field Detail
-
ROOT_INFO
public static final FileInfo ROOT_INFO
-
-
Method Detail
-
getPath
public URI getPath()
Gets the path of this file or directory.
-
isDirectory
public boolean isDirectory()
Indicates whether this item is a directory.
-
isInferredDirectory
public boolean isInferredDirectory()
Indicates whether this item is an inferred directory.
-
isGlobalRoot
public boolean isGlobalRoot()
Indicates whether this instance has information about the unique, shared root of the underlying storage system.
-
getCreationTime
public long getCreationTime()
Gets creation time of this item.Time is expressed as milliseconds since January 1, 1970 UTC.
-
getSize
public long getSize()
Gets the size of this file or directory.For files, size is in number of bytes. For directories size is 0. For items that do not exist, size is -1.
-
getModificationTime
public long getModificationTime()
Gets the modification time of this file if one is set, otherwise the value ofgetCreationTime()is returned.Time is expressed as milliseconds since January 1, 1970 UTC.
-
getAttributes
public Map<String,byte[]> getAttributes()
Retrieve file attributes for this file.- Returns:
- A map of file attributes
-
exists
public boolean exists()
Indicates whether this file or directory exists.
-
getCrc32cChecksum
public byte[] getCrc32cChecksum()
Returns CRC32C checksum of the file ornull.
-
getMd5Checksum
public byte[] getMd5Checksum()
Returns MD5 checksum of the file ornull.
-
toString
public String toString()
Gets string representation of this instance.
-
fromItemInfo
public static FileInfo fromItemInfo(GoogleCloudStorageItemInfo itemInfo)
Handy factory method for constructing a FileInfo from a GoogleCloudStorageItemInfo while potentially returning a singleton instead of really constructing an object for cases like ROOT.
-
fromItemInfos
public static List<FileInfo> fromItemInfos(List<GoogleCloudStorageItemInfo> itemInfos)
Handy factory method for constructing a list of FileInfo from a list of GoogleCloudStorageItemInfo.
-
-