public class FileInfo extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FILE_MODIFICATION_TIMESTAMP_KEY |
static LogUtil |
log |
static FileInfo |
ROOT_INFO |
Modifier and Type | Method and Description |
---|---|
static void |
addModificationTimeToAttributes(Map<String,byte[]> attributes,
com.google.api.client.util.Clock clock)
Add a key and value representing the current time, as determined by the passed clock, to the
passed attributes dictionary.
|
static StorageResourceId |
convertToDirectoryPath(StorageResourceId resourceId)
Converts the given resourceId to look like a directory path.
|
static URI |
convertToDirectoryPath(URI path)
Converts the given path to look like a directory path.
|
static String |
convertToFilePath(String objectName)
Converts the given object name to look like a file path.
|
boolean |
exists()
Indicates whether this file or directory exists.
|
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.
|
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.
|
long |
getCreationTime()
Gets creation time of this item.
|
GoogleCloudStorageItemInfo |
getItemInfo()
Gets information about the underlying item.
|
long |
getModificationTime()
Gets the modification time of this file if one is set, otherwise the value of
getCreationTime() is returned. |
URI |
getPath()
Gets the path of this file or directory.
|
long |
getSize()
Gets the size of this file or directory.
|
boolean |
isDirectory()
Indicates whether this item is a directory.
|
static boolean |
isDirectoryPath(URI path)
Indicates whether the given path looks like a directory path.
|
boolean |
isGlobalRoot()
Indicates whether this instance has information about the unique, shared root of the
underlying storage system.
|
String |
toString()
Gets string representation of this instance.
|
public static LogUtil log
public static final FileInfo ROOT_INFO
public static final String FILE_MODIFICATION_TIMESTAMP_KEY
public URI getPath()
public boolean isDirectory()
public boolean isGlobalRoot()
public long getCreationTime()
public long getSize()
public long getModificationTime()
getCreationTime()
is returned.
Time is expressed as milliseconds since January 1, 1970 UTC.public Map<String,byte[]> getAttributes()
public boolean exists()
public String toString()
public GoogleCloudStorageItemInfo getItemInfo()
public static void addModificationTimeToAttributes(Map<String,byte[]> attributes, com.google.api.client.util.Clock clock)
attributes
- The file attributes map to updateclock
- The clock to retrieve the current time frompublic static String convertToFilePath(String objectName)
objectName
- Name of the object to inspect.public static FileInfo fromItemInfo(GoogleCloudStorageItemInfo itemInfo)
public static List<FileInfo> fromItemInfos(List<GoogleCloudStorageItemInfo> itemInfos)
public static boolean isDirectoryPath(URI path)
path
- Path to inspect.public static StorageResourceId convertToDirectoryPath(StorageResourceId resourceId)
resourceId
- StorageResourceId to convert.Copyright © 2015. All rights reserved.