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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intbooleanexists()Returns whether this file or directory exists.booleangetAttribute(int attribute) Returns the value of the specified attribute for this file.intgetError()Checks whether an I/O error was encountered while accessing this file or directory.longReturns the last modified time for this file, orEFS.NONEif the file does not exist or the last modified time could not be computed.longReturns the length of this file, orEFS.NONEif 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.booleanReturns whether this file is a directory, orfalseif this file does not exist.voidsetAttribute(int attribute, boolean value) Sets the value of the specified attribute for this file info.voidsetDirectory(boolean value) Sets whether this is a file or directory.voidsetError(int errorCode) Sets the error code indicating whether an I/O error was encountered when accessing the file.voidsetExists(boolean value) Sets whether this file or directory exists.voidsetLastModified(long value) Sets the last modified time for this file.voidsetLength(long value) Sets the length of this file.voidSets the name of this file.voidsetStringAttribute(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:
compareToin interfaceComparable<IFileInfo>- Since:
- 1.5
-
exists
public boolean exists()Description copied from interface:IFileInfoReturns whether this file or directory exists. -
getError
public int getError()Description copied from interface:IFileInfoChecks whether an I/O error was encountered while accessing this file or directory.- Specified by:
getErrorin interfaceIFileInfo- Returns:
IFileInfo.IO_ERRORif an I/O error was encountered, orIFileInfo.NONEotherwise.- Since:
- 1.4
-
getAttribute
public boolean getAttribute(int attribute) Description copied from interface:IFileInfoReturns the value of the specified attribute for this file. The attribute must be one of theEFS#ATTRIBUTE_*constants. Returnsfalseif this file does not exist, could not be accessed, or the provided attribute does not apply to this file system.- Specified by:
getAttributein 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:IFileInfoReturns the value of the specified attribute for this file. The attribute must be one of theEFS#ATTRIBUTE_*constants. Returnsnullif this file does not exist, could not be accessed, or the provided attribute does not apply to this file system.- Specified by:
getStringAttributein interfaceIFileInfo- Parameters:
attribute- The kind of attribute to return. Currently onlyEFS.ATTRIBUTE_LINK_TARGETis supported.- Returns:
- the value of the extended String attribute for this file.
- See Also:
-
getLastModified
public long getLastModified()Description copied from interface:IFileInfoReturns the last modified time for this file, orEFS.NONEif 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:
getLastModifiedin interfaceIFileInfo- Returns:
- the last modified time for this file, or
EFS.NONE
-
getLength
public long getLength()Description copied from interface:IFileInfoReturns the length of this file, orEFS.NONEif the file does not exist, or the length could not be computed. For directories, the return value is unspecified. -
getName
Description copied from interface:IFileInfoReturns the name of this file. -
isDirectory
public boolean isDirectory()Description copied from interface:IFileInfoReturns whether this file is a directory, orfalseif this file does not exist.- Specified by:
isDirectoryin interfaceIFileInfo- Returns:
trueif this file is a directory, andfalseotherwise.
-
setAttribute
public void setAttribute(int attribute, boolean value) Description copied from interface:IFileInfoSets 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:
setAttributein 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-trueif this is a directory, andfalseif this is a file.
-
setExists
public void setExists(boolean value) Sets whether this file or directory exists.- Parameters:
value-trueif this file exists, andfalseotherwise.
-
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_ERRORif this file has an I/O error, andIFileInfo.NONEotherwise.- Since:
- 1.4
-
setLastModified
public void setLastModified(long value) Description copied from interface:IFileInfoSets the last modified time for this file. A value ofEFS.NONEindicates 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:
setLastModifiedin 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.NONEindicates 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_TARGETis supported.value- The String attribute, ornullto clear the attribute- Since:
- org.eclipse.core.filesystem 1.1
-
toString
-