public class FileInfo extends Object implements IFileInfo
IFileInfo objects.| Constructor and Description |
|---|
FileInfo()
Creates a new file information object with default values.
|
FileInfo(String name)
Creates a new file information object.
|
| Modifier and Type | Method and Description |
|---|---|
Object |
clone() |
int |
compareTo(Object o) |
boolean |
exists()
Returns whether this file or directory exists.
|
boolean |
getAttribute(int attribute)
Returns the value of the specified attribute for this file.
|
int |
getError()
Checks whether an I/O error was encountered while accessing this file or directory.
|
long |
getLastModified()
Returns the last modified time for this file, or
EFS.NONE
if the file does not exist or the last modified time could not be computed. |
long |
getLength()
Returns the length of this file, or
EFS.NONE
if the file does not exist, or the length could not be computed. |
String |
getName()
Returns the name of this file.
|
String |
getStringAttribute(int attribute)
Returns the value of the specified attribute for this file.
|
boolean |
isDirectory()
Returns whether this file is a directory, or
false if this
file does not exist. |
void |
setAttribute(int attribute,
boolean value)
Sets the value of the specified attribute for this file info.
|
void |
setDirectory(boolean value)
Sets whether this is a file or directory.
|
void |
setError(int errorCode)
Sets the error code indicating whether an I/O error was encountered when accessing the file.
|
void |
setExists(boolean value)
Sets whether this file or directory exists.
|
void |
setLastModified(long value)
Sets the last modified time for this file.
|
void |
setLength(long value)
Sets the length of this file.
|
void |
setName(String name)
Sets the name of this file.
|
void |
setStringAttribute(int attribute,
String value)
Sets or clears a String attribute, e.g. symbolic link target.
|
String |
toString()
For debugging purposes only.
|
public FileInfo()
public FileInfo(String name)
name - The name of this filepublic int compareTo(Object o)
compareTo in interface Comparablepublic boolean exists()
IFileInfopublic int getError()
IFileInfogetError in interface IFileInfoIFileInfo.IO_ERROR if an I/O error was encountered, or IFileInfo.NONE otherwise.IFileInfo.getError()public boolean getAttribute(int attribute)
IFileInfoEFS#ATTRIBUTE_*
constants. Returns false if this file does not exist,
could not be accessed, or the provided attribute does not apply to this
file system.getAttribute in interface IFileInfoattribute - The attribute to retrieve the value forIFileSystem.attributes()public String getStringAttribute(int attribute)
IFileInfoEFS#ATTRIBUTE_*
constants. Returns null if this file does not exist,
could not be accessed, or the provided attribute does not apply to this
file system.getStringAttribute in interface IFileInfoattribute - The kind of attribute to return. Currently only
EFS.ATTRIBUTE_LINK_TARGET is supported.IFileSystem.attributes()public long getLastModified()
IFileInfoEFS.NONE
if the file does not exist or the last modified time could not be computed.
The time is represented as the number of Universal Time (UT) milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
getLastModified in interface IFileInfoEFS.NONEpublic long getLength()
IFileInfoEFS.NONE
if the file does not exist, or the length could not be computed.
For directories, the return value is unspecified.public String getName()
IFileInfopublic boolean isDirectory()
IFileInfofalse if this
file does not exist.isDirectory in interface IFileInfotrue if this file is a directory, and false
otherwise.public void setAttribute(int attribute,
boolean value)
IFileInfoEFS#ATTRIBUTE_* constants.
Note that not all attributes are applicable in a given file system.
Users must call IFileStore.putInfo(IFileInfo, int, IProgressMonitor)
before changes made to this info take effect in an underlying file.
setAttribute in interface IFileInfoattribute - The attribute to set the value forvalue - the value of the specified attribute for this file.IFileSystem.attributes()public void setDirectory(boolean value)
value - true if this is a directory, and false
if this is a file.public void setExists(boolean value)
value - true if this file exists, and false
otherwise.public void setError(int errorCode)
errorCode - IFileInfo.IO_ERROR if this file has an I/O error,
and IFileInfo.NONE otherwise.public void setLastModified(long value)
IFileInfoEFS.NONE
indicates the file does not exist or the last modified time could not be computed.
Users must call IFileStore.putInfo(IFileInfo, int, IProgressMonitor)
before changes made to this info take effect in an underlying file.
setLastModified in interface IFileInfovalue - the last modified time for this file, or EFS.NONEpublic void setLength(long value)
EFS.NONE
indicates the file does not exist, is a directory, or the length could not be computed.value - the length of this file, or EFS.NONEpublic void setName(String name)
name - The file namepublic void setStringAttribute(int attribute,
String value)
attribute - The kind of attribute to set. Currently only
EFS.ATTRIBUTE_LINK_TARGET is supported.value - The String attribute, or null to clear
the attribute
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.