|
|
|
|
org.eclipse.core.filesystem.provider
Class FileInfo
java.lang.Object
org.eclipse.core.filesystem.provider.FileInfo
-
All Implemented Interfaces:
-
Cloneable,
Comparable,
IFileInfo
-
public class FileInfo
- extends
Object
- implements
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.
Constructor Summary
|
FileInfo
()
Creates a new file information object with default values. |
FileInfo
(
String name)
Creates a new file information object. |
Method Summary
|
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. |
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
|
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. |
FileInfo
public FileInfo()
- Creates a new file information object with default values.
FileInfo
public FileInfo(
String name)
- Creates a new file information object. All values except the file name
will have default values.
-
Parameters:
-
name - The name of this file
clone
public
Object clone()
-
-
Overrides:
-
clone
in class
Object
-
compareTo
public int compareTo(
Object o)
-
-
Specified by:
-
compareTo
in interface
Comparable
-
exists
public boolean exists()
-
Description copied from interface:
IFileInfo
- Returns whether this file or directory exists.
-
-
Specified by:
-
exists
in interface
IFileInfo
-
-
Returns:
-
true if this file exists, and false
otherwise.
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 the
EFS#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.
-
-
Specified by:
-
getAttribute
in interface
IFileInfo
-
-
Parameters:
-
attribute - The attribute to retrieve the value for
-
Returns:
- the value of the specified attribute for this file.
-
See Also:
-
IFileSystem.attributes()
getStringAttribute
public
String getStringAttribute(int attribute)
-
Description copied from interface:
IFileInfo
- Returns the value of the specified attribute for this file. The attribute
must be one of the
EFS#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.
-
-
Specified by:
-
getStringAttribute
in interface
IFileInfo
-
-
Parameters:
-
attribute - The kind of attribute to return. Currently only
EFS.ATTRIBUTE_LINK_TARGET is supported.
-
Returns:
- the value of the extended String attribute for this file.
-
See Also:
-
IFileSystem.attributes()
getLastModified
public long getLastModified()
-
Description copied from interface:
IFileInfo
- 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.
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 interface
IFileInfo
-
-
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, or
EFS.NONE
if the file does not exist, or the length could not be computed.
For directories, the return value is unspecified.
-
-
Specified by:
-
getLength
in interface
IFileInfo
-
-
Returns:
- the length of this file, or
EFS.NONE
getName
public
String getName()
-
Description copied from interface:
IFileInfo
- Returns the name of this file.
-
-
Specified by:
-
getName
in interface
IFileInfo
-
-
Returns:
- the name of this file.
isDirectory
public boolean isDirectory()
-
Description copied from interface:
IFileInfo
- Returns whether this file is a directory, or
false if this
file does not exist.
-
-
Specified by:
-
isDirectory
in interface
IFileInfo
-
-
Returns:
-
true if this file is a directory, and false
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 the
EFS#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 interface
IFileInfo
-
-
Parameters:
-
attribute - The attribute to set the value for -
value - the value of the specified attribute for this file. -
See Also:
-
IFileSystem.attributes()
setDirectory
public void setDirectory(boolean value)
- Sets whether this is a file or directory.
-
-
-
Parameters:
-
value - true if this is a directory, and false
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, and false
otherwise.
setLastModified
public void setLastModified(long value)
-
Description copied from interface:
IFileInfo
- Sets the last modified time for this file. A value of
EFS.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 interface
IFileInfo
-
-
Parameters:
-
value - the last modified time for this file, or
EFS.NONE
setLength
public void setLength(long value)
- Sets the length of this file. A value of
EFS.NONE
indicates the file does not exist, is a directory, or the length could not be computed.
-
-
-
Parameters:
-
value - the length of this file, or
EFS.NONE
setName
public void setName(
String name)
- Sets the name of this file.
-
-
-
Parameters:
-
name - The file name
setStringAttribute
public void setStringAttribute(int attribute,
String value)
- Sets or clears a String attribute, e.g. symbolic link target.
-
-
-
Parameters:
-
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 -
Since:
- org.eclipse.core.filesystem 1.1
toString
public
String toString()
- For debugging purposes only.
-
-
Overrides:
-
toString
in class
Object
-
Guidelines for using Eclipse APIs.
Copyright (c) Eclipse contributors and others 2000, 2008. All rights reserved.
|
|
|