public class FileInfo extends Object implements IFileInfo
IFileInfo
objects.
This class is not intended to be subclassed.
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.
|
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, is a directory, or the length could not be computed. |
String |
getName()
Returns the name of 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.
|
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 Comparable
public boolean exists()
IFileInfo
public boolean getAttribute(int attribute)
IFileInfo
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.getAttribute
in interface IFileInfo
attribute
- The attribute to retrieve the value forIFileSystem.attributes()
public long getLastModified()
IFileInfo
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).
getLastModified
in interface IFileInfo
EFS.NONE
public long getLength()
IFileInfo
EFS.NONE
if the file does not exist, is a directory, or the length could not be computed.public String getName()
IFileInfo
public boolean isDirectory()
IFileInfo
false
if this
file does not exist.isDirectory
in interface IFileInfo
true
if this file is a directory, and false
otherwise.public void setAttribute(int attribute, boolean value)
IFileInfo
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.
setAttribute
in interface IFileInfo
attribute
- 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 setLastModified(long value)
IFileInfo
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.
setLastModified
in interface IFileInfo
value
- the last modified time for this file, or EFS.NONE
public 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.NONE
public void setName(String name)
name
- The file nameGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.