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 Comparable
public boolean exists()
IFileInfo
public int getError()
IFileInfo
getError
in interface IFileInfo
IFileInfo.IO_ERROR
if an I/O error was encountered, or IFileInfo.NONE
otherwise.IFileInfo.getError()
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 String getStringAttribute(int attribute)
IFileInfo
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.getStringAttribute
in interface IFileInfo
attribute
- The kind of attribute to return. Currently only
EFS.ATTRIBUTE_LINK_TARGET
is supported.IFileSystem.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, or the length could not be computed.
For directories, the return value is unspecified.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 setError(int errorCode)
errorCode
- IFileInfo.IO_ERROR
if this file has an I/O error,
and IFileInfo.NONE
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 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.