Class FileInfo

java.lang.Object
org.eclipse.core.filesystem.provider.FileInfo
All Implemented Interfaces:
Cloneable, Comparable<IFileInfo>, 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.
  • Field Summary

    Fields inherited from interface org.eclipse.core.filesystem.IFileInfo

    IO_ERROR, NONE
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new file information object with default values.
    Creates a new file information object.
  • Method Summary

    Modifier and Type
    Method
    Description
     
    int
     
    boolean
    Returns whether this file or directory exists.
    boolean
    getAttribute(int attribute)
    Returns the value of the specified attribute for this file.
    int
    Checks whether an I/O error was encountered while accessing this file or directory.
    long
    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
    Returns the length of this file, or EFS.NONE if the file does not exist, or the length could not be computed.
    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, 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
    Sets the name of this file.
    void
    setStringAttribute(int attribute, String value)
    Sets or clears a String attribute, e.g. symbolic link target.
    For debugging purposes only.

    Methods inherited from class java.lang.Object

    equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • 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
  • Method Details

    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • compareTo

      public int compareTo(IFileInfo o)
      Specified by:
      compareTo in interface Comparable<IFileInfo>
      Since:
      1.5
    • 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 if the file does not exist or an I/O error was encountered.
    • 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 interface IFileInfo
      Returns:
      IFileInfo.IO_ERROR if an I/O error was encountered, or IFileInfo.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 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:
    • 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:
    • 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:
    • 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.
    • 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, and IFileInfo.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 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