Enum FileType

  • All Implemented Interfaces:
    Serializable, Comparable<FileType>

    public enum FileType
    extends Enum<FileType>
    A file type. Files on NTFS are limited to the following types: NONEXISTENT, FILE, DIR (folder), and UNKNOWN (the file may or may not exist, and, if it does, its type cannot be determined). On Linux, LINK_FILE and LINK_DIR also apply to symbolic links that point to symbolic links (and so on) that eventually point to a file or directory, respectively.
    Since:
    0.5.0
    Version:
    $Id: FileType.java 16154 2012-07-14 16:34:05Z colin $
    Author:
    tlerios@marketcetera.com
    • Enum Constant Detail

      • NONEXISTENT

        public static final FileType NONEXISTENT
      • LINK_FILE

        public static final FileType LINK_FILE
      • FILE

        public static final FileType FILE
      • LINK_DIR

        public static final FileType LINK_DIR
      • LINK_UNKNOWN

        public static final FileType LINK_UNKNOWN
      • UNKNOWN

        public static final FileType UNKNOWN
    • Constructor Detail

      • FileType

        private FileType()
    • Method Detail

      • values

        public static FileType[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (FileType c : FileType.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static FileType valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
        Parameters:
        name - the name of the enum constant to be returned.
        Returns:
        the enum constant with the specified name
        Throws:
        IllegalArgumentException - if this enum type has no constant with the specified name
        NullPointerException - if the argument is null
      • get

        public static final FileType get​(File file)
        Returns the enumerated constant representing the type of the given file.
        Parameters:
        file - The file. It may be null, in which case UNKNOWN is returned.
        Returns:
        The enumerated constant.
      • get

        public static final FileType get​(String name)
        Returns the enumerated constant representing the type of the file with the given name.
        Parameters:
        name - The file name. It may be null, in which case UNKNOWN is returned.
        Returns:
        The enumerated constant.
      • isSymbolicLink

        public boolean isSymbolicLink()
        Returns true if the receiver represents a symbolic link.
        Returns:
        True if so.
      • isDirectory

        public boolean isDirectory()
        Returns true if the receiver represents a directory (possibly via a symbolic link).
        Returns:
        True if so.
      • isFile

        public boolean isFile()
        Returns true if the receiver represents a plain file (possibly via a symbolic link).
        Returns:
        True if so.