Class FileInfo
java.lang.Object
org.eclipse.core.filesystem.provider.FileInfo
- All Implemented Interfaces:
Cloneable
,Comparable<IFileInfo>
,IFileInfo
This class should be used by file system providers in their implementation
of API methods that return
IFileInfo
objects.- Since:
- org.eclipse.core.filesystem 1.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
int
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
Returns the last modified time for this file, orEFS.NONE
if the file does not exist or the last modified time could not be computed.long
Returns the length of this file, orEFS.NONE
if the file does not exist, or the length could not be computed.getName()
Returns the name of this file.getStringAttribute
(int attribute) Returns the value of the specified attribute for this file.boolean
Returns whether this file is a directory, orfalse
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
Sets the name of this file.void
setStringAttribute
(int attribute, String value) Sets or clears a String attribute, e.g. symbolic link target.toString()
-
Constructor Details
-
FileInfo
public FileInfo()Creates a new file information object with default values. -
FileInfo
Creates a new file information object. All values except the file name will have default values.- Parameters:
name
- The name of this file
-
-
Method Details
-
clone
-
compareTo
- Specified by:
compareTo
in interfaceComparable<IFileInfo>
- Since:
- 1.5
-
exists
public boolean exists()Description copied from interface:IFileInfo
Returns whether this file or directory exists. -
getError
public int getError()Description copied from interface:IFileInfo
Checks whether an I/O error was encountered while accessing this file or directory.- Specified by:
getError
in interfaceIFileInfo
- Returns:
IFileInfo.IO_ERROR
if an I/O error was encountered, orIFileInfo.NONE
otherwise.- Since:
- 1.4
-
getAttribute
public boolean getAttribute(int attribute) Description copied from interface:IFileInfo
Returns the value of the specified attribute for this file. The attribute must be one of theEFS#ATTRIBUTE_*
constants. Returnsfalse
if this file does not exist, could not be accessed, or the provided attribute does not apply to this file system.- Specified by:
getAttribute
in interfaceIFileInfo
- Parameters:
attribute
- The attribute to retrieve the value for- Returns:
- the value of the specified attribute for this file.
- See Also:
-
getStringAttribute
Description copied from interface:IFileInfo
Returns the value of the specified attribute for this file. The attribute must be one of theEFS#ATTRIBUTE_*
constants. Returnsnull
if this file does not exist, could not be accessed, or the provided attribute does not apply to this file system.- Specified by:
getStringAttribute
in interfaceIFileInfo
- Parameters:
attribute
- The kind of attribute to return. Currently onlyEFS.ATTRIBUTE_LINK_TARGET
is supported.- Returns:
- the value of the extended String attribute for this file.
- See Also:
-
getLastModified
public long getLastModified()Description copied from interface:IFileInfo
Returns the last modified time for this file, orEFS.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).
- Specified by:
getLastModified
in interfaceIFileInfo
- Returns:
- the last modified time for this file, or
EFS.NONE
-
getLength
public long getLength()Description copied from interface:IFileInfo
Returns the length of this file, orEFS.NONE
if the file does not exist, or the length could not be computed. For directories, the return value is unspecified. -
getName
Description copied from interface:IFileInfo
Returns the name of this file. -
isDirectory
public boolean isDirectory()Description copied from interface:IFileInfo
Returns whether this file is a directory, orfalse
if this file does not exist.- Specified by:
isDirectory
in interfaceIFileInfo
- Returns:
true
if this file is a directory, andfalse
otherwise.
-
setAttribute
public void setAttribute(int attribute, boolean value) Description copied from interface:IFileInfo
Sets the value of the specified attribute for this file info. The attribute must be one of theEFS#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.- Specified by:
setAttribute
in interfaceIFileInfo
- Parameters:
attribute
- The attribute to set the value forvalue
- the value of the specified attribute for this file.- See Also:
-
setDirectory
public void setDirectory(boolean value) Sets whether this is a file or directory.- Parameters:
value
-true
if this is a directory, andfalse
if this is a file.
-
setExists
public void setExists(boolean value) Sets whether this file or directory exists.- Parameters:
value
-true
if this file exists, andfalse
otherwise.
-
setError
public void setError(int errorCode) Sets the error code indicating whether an I/O error was encountered when accessing the file.- Parameters:
errorCode
-IFileInfo.IO_ERROR
if this file has an I/O error, andIFileInfo.NONE
otherwise.- Since:
- 1.4
-
setLastModified
public void setLastModified(long value) Description copied from interface:IFileInfo
Sets the last modified time for this file. A value ofEFS.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.- Specified by:
setLastModified
in interfaceIFileInfo
- Parameters:
value
- the last modified time for this file, orEFS.NONE
-
setLength
public void setLength(long value) Sets the length of this file. A value ofEFS.NONE
indicates the file does not exist, is a directory, or the length could not be computed.- Parameters:
value
- the length of this file, orEFS.NONE
-
setName
Sets the name of this file.- Parameters:
name
- The file name
-
setStringAttribute
Sets or clears a String attribute, e.g. symbolic link target.- Parameters:
attribute
- The kind of attribute to set. Currently onlyEFS.ATTRIBUTE_LINK_TARGET
is supported.value
- The String attribute, ornull
to clear the attribute- Since:
- org.eclipse.core.filesystem 1.1
-
toString
-