org.gjt.sp.jedit.io

## Class VFSFile

- java.lang.Object
- - org.gjt.sp.jedit.io.VFSFile

- All Implemented Interfaces:
    java.io.Serializable
  Direct Known Subclasses:
    FavoritesVFS.Favorite, FileVFS.LocalFile

      public class VFSFile
      extends java.lang.Object
      implements java.io.Serializable

  A directory entry returned from a file listing.
  Since:
    jEdit 4.3pre2
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.awt.Color` | `color`
    `protected boolean` | `colorCalculated`
    `static int` | `DIRECTORY`
    `static int` | `FILE`
    `static int` | `FILESYSTEM`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `VFSFile()`
    `VFSFile(java.lang.String name, java.lang.String path, java.lang.String deletePath, int type, long length, boolean hidden)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `fetchAttrs()` Fetch some attributes of the file.
    `protected boolean` | `fetchedAttrs()` Returns true if the attributes are already fetched.
    `static java.lang.String` | `findCompletion(java.lang.String path, java.lang.String complete, VFSBrowser browser, boolean dirsOnly)`
    `static int` | `findCompletion(VFSFile[] files, int start, int end, java.lang.String str, boolean dirsOnly)` Return the index of a file whose name matches the given string, in a case-insensitive manner.
    `java.awt.Color` | `getColor()` Returns the color that will be used to display the file.
    `javax.swing.Icon` | `getDefaultIcon(boolean expanded)` Returns the default icon of the file.
    `javax.swing.Icon` | `getDefaultIcon(boolean expanded, boolean openBuffer)` Returns the default icon for the file.
    `java.lang.String` | `getDeletePath()`
    `java.lang.String` | `getExtendedAttribute(java.lang.String name)` Returns the value of an extended attribute.
    `javax.swing.Icon` | `getIcon(boolean expanded)` Returns the icon for the file.
    `javax.swing.Icon` | `getIcon(boolean expanded, boolean openBuffer)` Returns the icon for the file.
    `long` | `getLength()`
    `java.lang.String` | `getName()`
    `java.lang.String` | `getPath()`
    `java.lang.String` | `getSymlinkPath()`
    `int` | `getType()`
    `VFS` | `getVFS()`
    `boolean` | `isBinary(java.lang.Object session)` Check if a file is binary file.
    `boolean` | `isHidden()`
    `boolean` | `isReadable()`
    `boolean` | `isWriteable()`
    `void` | `setDeletePath(java.lang.String deletePath)`
    `void` | `setHidden(boolean hidden)`
    `void` | `setLength(long length)`
    `void` | `setName(java.lang.String name)`
    `void` | `setPath(java.lang.String path)`
    `void` | `setReadable(boolean canRead)`
    `void` | `setSymlinkPath(java.lang.String symlinkPath)`
    `void` | `setType(int type)`
    `void` | `setWriteable(boolean canWrite)`
    `java.lang.String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### FILE

          public static final int FILE

      See Also:
        Constant Field Values

    - #### DIRECTORY

          public static final int DIRECTORY

      See Also:
        Constant Field Values

    - #### FILESYSTEM

          public static final int FILESYSTEM

      See Also:
        Constant Field Values

    - #### colorCalculated

          protected boolean colorCalculated

    - #### color

          protected java.awt.Color color

  - ### Constructor Detail

    - #### VFSFile

          public VFSFile()

      Since:
        jEdit 4.3pre2

    - #### VFSFile

          public VFSFile(java.lang.String name,
                 java.lang.String path,
                 java.lang.String deletePath,
                 int type,
                 long length,
                 boolean hidden)

  - ### Method Detail

    - #### findCompletion

          public static int findCompletion(VFSFile[] files,
                           int start,
                           int end,
                           java.lang.String str,
                           boolean dirsOnly)

      Return the index of a file whose name matches the given string, in a case-insensitive manner. Exact matches are preferred.
      Parameters:
        `files` - The list of files
        `start` - The start index, inclusive
        `end` - The end index, exclusive
        `str` - The string to match
        `dirsOnly` - Only match directories?
      Since:
        jEdit 4.3pre3

    - #### findCompletion

          public static java.lang.String findCompletion(java.lang.String path,
                                        java.lang.String complete,
                                        VFSBrowser browser,
                                        boolean dirsOnly)

    - #### getIcon

          public final javax.swing.Icon getIcon(boolean expanded)

      Returns the icon for the file.
      Since:
        jEdit 4.3pre9

    - #### getIcon

          public javax.swing.Icon getIcon(boolean expanded,
                                 boolean openBuffer)

      Returns the icon for the file. Implementations of File system browsers can override this method
      Since:
        jEdit 4.3pre9

    - #### getDefaultIcon

          public final javax.swing.Icon getDefaultIcon(boolean expanded,
                                        boolean openBuffer)

      Returns the default icon for the file.
      Since:
        jEdit 4.3pre9

    - #### getDefaultIcon

          public final javax.swing.Icon getDefaultIcon(boolean expanded)

      Returns the default icon of the file.
      Returns:
        the default icon of the file
      Since:
        jEdit 4.3pre9

    - #### getVFS

          public VFS getVFS()

      Returns:
        The originating virtual file system of this file.

    - #### getName

          public java.lang.String getName()

    - #### setName

          public void setName(java.lang.String name)

    - #### isBinary

          public boolean isBinary(java.lang.Object session)
                           throws java.io.IOException

      Check if a file is binary file.
      Parameters:
        `session` - the VFS session
      Returns:
        `true` if the file was detected as binary
      Throws:
        `java.io.IOException` - IOException If an I/O error occurs
      Since:
        jEdit 4.3pre5

    - #### getPath

          public java.lang.String getPath()

    - #### setPath

          public void setPath(java.lang.String path)

    - #### getSymlinkPath

          public java.lang.String getSymlinkPath()

    - #### setSymlinkPath

          public void setSymlinkPath(java.lang.String symlinkPath)

    - #### getDeletePath

          public java.lang.String getDeletePath()

    - #### setDeletePath

          public void setDeletePath(java.lang.String deletePath)

    - #### getType

          public int getType()

    - #### setType

          public void setType(int type)

    - #### getLength

          public long getLength()

    - #### setLength

          public void setLength(long length)

    - #### isHidden

          public boolean isHidden()

    - #### setHidden

          public void setHidden(boolean hidden)

    - #### isReadable

          public boolean isReadable()

    - #### setReadable

          public void setReadable(boolean canRead)

    - #### isWriteable

          public boolean isWriteable()

    - #### setWriteable

          public void setWriteable(boolean canWrite)

    - #### getExtendedAttribute

          public java.lang.String getExtendedAttribute(java.lang.String name)

      Returns the value of an extended attribute. Note that this returns formatted strings (eg, "10 Mb" for a file size of 1048576 bytes). If you need access to the raw data, access fields and methods of this class.
      Parameters:
        `name` - The extended attribute name
      Since:
        jEdit 4.2pre1

    - #### getColor

          public java.awt.Color getColor()

      Returns the color that will be used to display the file.
      Returns:
        the color of the file

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

    - #### fetchedAttrs

          protected boolean fetchedAttrs()

      Returns true if the attributes are already fetched.
      Returns:
        `true` if the attributes are already fetched
      See Also:
        `fetchAttrs()`

    - #### fetchAttrs

          protected void fetchAttrs()

      Fetch some attributes of the file. Some attributes are not fetched during file initialization because it takes time. They are fetched here. VFS implementation should overwrite this