Class File


  • public abstract class File
    extends java.lang.Object
    A file object, containing both the file's metadata and content.
    Author:
    Colin Decker
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void deleteAttribute​(java.lang.String view, java.lang.String attribute)
      Deletes the given attribute from the given view.
      java.lang.Object getAttribute​(java.lang.String view, java.lang.String attribute)
      Gets the value of the given attribute in the given view.
      com.google.common.collect.ImmutableSet<java.lang.String> getAttributeNames​(java.lang.String view)
      Returns the names of the attributes contained in the given attribute view in the file's attributes table.
      long getCreationTime()
      Gets the creation time of the file.
      long getLastAccessTime()
      Gets the last access time of the file.
      long getLastModifiedTime()
      Gets the last modified time of the file.
      int id()
      Returns the ID of this file.
      boolean isDirectory()
      Returns whether or not this file is a directory.
      boolean isRegularFile()
      Returns whether or not this file is a regular file.
      boolean isSymbolicLink()
      Returns whether or not this file is a symbolic link.
      int links()
      Returns the current count of links to this file.
      void setAttribute​(java.lang.String view, java.lang.String attribute, java.lang.Object value)
      Sets the given attribute in the given view to the given value.
      long size()
      Returns the size, in bytes, of this file's content.
      java.lang.String toString()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Method Detail

      • id

        public int id()
        Returns the ID of this file.
      • size

        public long size()
        Returns the size, in bytes, of this file's content. Directories and symbolic links have a size of 0.
      • isDirectory

        public final boolean isDirectory()
        Returns whether or not this file is a directory.
      • isRegularFile

        public final boolean isRegularFile()
        Returns whether or not this file is a regular file.
      • isSymbolicLink

        public final boolean isSymbolicLink()
        Returns whether or not this file is a symbolic link.
      • links

        public final int links()
        Returns the current count of links to this file.
      • getCreationTime

        public final long getCreationTime()
        Gets the creation time of the file.
      • getLastAccessTime

        public final long getLastAccessTime()
        Gets the last access time of the file.
      • getLastModifiedTime

        public final long getLastModifiedTime()
        Gets the last modified time of the file.
      • getAttributeNames

        public final com.google.common.collect.ImmutableSet<java.lang.String> getAttributeNames​(java.lang.String view)
        Returns the names of the attributes contained in the given attribute view in the file's attributes table.
      • getAttribute

        @Nullable
        public final java.lang.Object getAttribute​(java.lang.String view,
                                                   java.lang.String attribute)
        Gets the value of the given attribute in the given view.
      • setAttribute

        public final void setAttribute​(java.lang.String view,
                                       java.lang.String attribute,
                                       java.lang.Object value)
        Sets the given attribute in the given view to the given value.
      • deleteAttribute

        public final void deleteAttribute​(java.lang.String view,
                                          java.lang.String attribute)
        Deletes the given attribute from the given view.
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object