Enum OS

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Comparable<OS>

    public enum OS
    extends java.lang.Enum<OS>
    • Enum Constant Detail

      • WINDOWS_NT

        public static final OS WINDOWS_NT
      • WINDOWS_95

        public static final OS WINDOWS_95
      • WINDOWS_98

        public static final OS WINDOWS_98
      • WINDOWS_2000

        public static final OS WINDOWS_2000
      • WINDOWS_VISTA

        public static final OS WINDOWS_VISTA
      • WINDOWS_7

        public static final OS WINDOWS_7
      • WINDOWS_OTHER

        public static final OS WINDOWS_OTHER
      • SOLARIS

        public static final OS SOLARIS
      • LINUX

        public static final OS LINUX
      • HP_UX

        public static final OS HP_UX
      • IBM_AIX

        public static final OS IBM_AIX
      • SGI_IRIX

        public static final OS SGI_IRIX
      • SUN_OS

        public static final OS SUN_OS
      • COMPAQ_TRU64_UNIX

        public static final OS COMPAQ_TRU64_UNIX
      • MAC

        public static final OS MAC
      • FREE_BSD

        public static final OS FREE_BSD
      • OS2

        public static final OS OS2
      • COMPAQ_OPEN_VMS

        public static final OS COMPAQ_OPEN_VMS
      • OTHER

        public static final OS OTHER
        Unrecognized OS
    • Field Detail

      • names

        private final java.lang.String[] names
      • current

        private static OS current
    • Constructor Detail

      • OS

        private OS​(java.lang.String... names)
    • Method Detail

      • values

        public static OS[] 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 (OS c : OS.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static OS valueOf​(java.lang.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:
        java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
        java.lang.NullPointerException - if the argument is null
      • isWindows

        public boolean isWindows()
        Returns:
        true if this OS belongs to windows family
      • isUnix

        public boolean isUnix()
        Returns:
        true if this OS belongs to *nix family
      • get

        public static OS get​(java.lang.String osName)
        Parameters:
        osName - name of OS as returned by System.getProperty("os.name")
        Returns:
        OS for the specified osName
      • get

        public static OS get()
        Returns:
        OS on which this JVM is running