Interface IFileInfo

All Superinterfaces:
Cloneable, Comparable<IFileInfo>
All Known Implementing Classes:
FileInfo

public interface IFileInfo extends Comparable<IFileInfo>, Cloneable
A file info is a simple structure holding information about a file or directory. The information contained here is static; changes to this object will not cause corresponding changes to any file on disk, and changes to files on disk are not reflected in this object. At best, an IFileInfo represents a snapshot of the state of a file at a particular moment in time.
Since:
org.eclipse.core.filesystem 1.0
See Also:
Restriction:
This interface is not intended to be implemented by clients. File store implementations should use the concrete class FileStore
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    The constant indicating that an I/O error was encountered while retrieving file information.
    static final int
    The constant indicating that file information was retrieved successfully.
  • Method Summary

    Modifier and Type
    Method
    Description
    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
    setLastModified(long time)
    Sets the last modified time for this file.

    Methods inherited from interface java.lang.Comparable

    compareTo
  • Field Details

    • NONE

      static final int NONE
      The constant indicating that file information was retrieved successfully.
      Since:
      1.4
      See Also:
    • IO_ERROR

      static final int IO_ERROR
      The constant indicating that an I/O error was encountered while retrieving file information.
      Since:
      1.4
      See Also:
  • Method Details

    • exists

      boolean exists()
      Returns whether this file or directory exists.
      Returns:
      true if this file exists, and false if the file does not exist or an I/O error was encountered.
    • getError

      int getError()
      Checks whether an I/O error was encountered while accessing this file or directory.
      Returns:
      IO_ERROR if an I/O error was encountered, or NONE otherwise.
      Since:
      1.4
    • getAttribute

      boolean getAttribute(int attribute)
      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.
      Parameters:
      attribute - The attribute to retrieve the value for
      Returns:
      the value of the specified attribute for this file.
      See Also:
    • getStringAttribute

      String getStringAttribute(int attribute)
      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.
      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.
      Since:
      org.eclipse.core.filesystem 1.1
      See Also:
    • getLastModified

      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.

      The time is represented as the number of Universal Time (UT) milliseconds since the epoch (00:00:00 GMT, January 1, 1970).

      Returns:
      the last modified time for this file, or EFS.NONE
    • getLength

      long getLength()
      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.
      Returns:
      the length of this file, or EFS.NONE
    • getName

      String getName()
      Returns the name of this file.
      Returns:
      the name of this file.
    • isDirectory

      boolean isDirectory()
      Returns whether this file is a directory, or false if this file does not exist.
      Returns:
      true if this file is a directory, and false otherwise.
    • setAttribute

      void setAttribute(int attribute, boolean value)
      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.

      Parameters:
      attribute - The attribute to set the value for
      value - the value of the specified attribute for this file.
      See Also:
    • setLastModified

      void setLastModified(long time)
      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.

      Parameters:
      time - the last modified time for this file, or EFS.NONE