Class OS


  • public final class OS
    extends java.lang.Object
    Some simple OS specific utilities.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static boolean IS_LINUX
      True if OS is Linux
      static boolean IS_OSX
      True if OS is OSX
      static boolean IS_UNIX
      True if OS is Unix (Unix || AIX || Linux || OSX)
      static boolean IS_WINDOWS
      True if OS is windows
      static java.lang.String LN
      Line Separator string.
      static java.lang.String OS_NAME
      The name of the OS
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private OS()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      private static boolean isOSName​(java.lang.String name)
      Simple test for OS Name
      static java.lang.String separators​(java.lang.String path)
      Convert path separators to the System path separators.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • OS_NAME

        public static final java.lang.String OS_NAME
        The name of the OS
      • IS_WINDOWS

        public static final boolean IS_WINDOWS
        True if OS is windows
      • IS_OSX

        public static final boolean IS_OSX
        True if OS is OSX
      • IS_LINUX

        public static final boolean IS_LINUX
        True if OS is Linux
      • IS_UNIX

        public static final boolean IS_UNIX
        True if OS is Unix (Unix || AIX || Linux || OSX)
      • LN

        public static final java.lang.String LN
        Line Separator string.

        Note: For Java 1.7 or newer, use System.lineSeparator()

    • Constructor Detail

      • OS

        private OS()
    • Method Detail

      • separators

        public static java.lang.String separators​(java.lang.String path)
        Convert path separators to the System path separators.

        This helps ensure that the paths provided in the unit tests work equally as well on unix / osx / windows.

        Parameters:
        path - the raw path to convert
        Returns:
        the converted path
      • isOSName

        private static boolean isOSName​(java.lang.String name)
        Simple test for OS Name
        Parameters:
        name - the name to look for
        Returns:
        true if the name is found in the system OS name.