Class OperatingSystemUtils


  • public final class OperatingSystemUtils
    extends java.lang.Object
    NOTE: This class was copied from plexus-utils, to allow this library to stand completely self-contained.
    • Constructor Detail

      • OperatingSystemUtils

        private OperatingSystemUtils()
    • Method Detail

      • getSystemEnvVars

        public static java.util.Properties getSystemEnvVars()
                                                     throws java.io.IOException
        Throws:
        java.io.IOException
      • getSystemEnvVars

        public static java.util.Properties getSystemEnvVars​(boolean caseSensitive)
                                                     throws java.io.IOException
        Return the shell environment variables. If caseSensitive == true, then envar keys will all be upper-case.
        Parameters:
        caseSensitive - Whether environment variable keys should be treated case-sensitively.
        Returns:
        Properties object of (possibly modified) envar keys mapped to their values.
        Throws:
        java.io.IOException - in case of an error.
      • setEnvVarSource

        public static void setEnvVarSource​(OperatingSystemUtils.EnvVarSource source)
        Set the source object to load the environment variables from. Default implementation should suffice. This is mostly for testing.
        Parameters:
        source - the EnvVarSource instance that loads the environment variables.
        Since:
        3.1.2