Package com.strobel.core
Class Environment
- java.lang.Object
-
- com.strobel.core.Environment
-
public final class Environment extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
ARCH_DATA_MODEL
private static java.util.logging.Logger
logger
private static java.lang.String
OS_ARCH
private static java.lang.String
OS_NAME
private static java.lang.String
OS_NAME_LOWER
private static java.util.regex.Pattern
VARIABLE_PATTERN
-
Constructor Summary
Constructors Modifier Constructor Description private
Environment()
Make sure nobody can instantiate the class
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
expandVariables(java.lang.String s)
Recursively expands any environment variable(s) defined within a String.static java.lang.String
expandVariables(java.lang.String s, boolean recursive)
Expands any environment variable(s) defined within a String.static int
getProcessorCount()
static java.lang.String
getVariable(java.lang.String variable)
Get any variable by name if defined on the systemstatic boolean
is32Bit()
static boolean
is64Bit()
static boolean
isAmd64()
static boolean
isFileSystemCaseSensitive()
static boolean
isLinux()
static boolean
isMac()
static boolean
isMacX64()
static boolean
isOS2()
static boolean
isSingleProcessor()
static boolean
isUnix()
static boolean
isWindows()
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
VARIABLE_PATTERN
private static final java.util.regex.Pattern VARIABLE_PATTERN
-
OS_NAME
private static final java.lang.String OS_NAME
-
OS_NAME_LOWER
private static final java.lang.String OS_NAME_LOWER
-
OS_ARCH
private static final java.lang.String OS_ARCH
-
ARCH_DATA_MODEL
private static final java.lang.String ARCH_DATA_MODEL
-
-
Method Detail
-
isWindows
public static boolean isWindows()
-
isOS2
public static boolean isOS2()
-
isMac
public static boolean isMac()
-
isLinux
public static boolean isLinux()
-
isUnix
public static boolean isUnix()
-
isFileSystemCaseSensitive
public static boolean isFileSystemCaseSensitive()
-
is32Bit
public static boolean is32Bit()
-
is64Bit
public static boolean is64Bit()
-
isAmd64
public static boolean isAmd64()
-
isMacX64
public static boolean isMacX64()
-
getVariable
public static java.lang.String getVariable(java.lang.String variable)
Get any variable by name if defined on the system- Parameters:
variable
- The string with variables to expand. It should be something like '$VARIABLE'- Returns:
- The expanded variable, empty if arg is null or variable is not defined
-
expandVariables
public static java.lang.String expandVariables(java.lang.String s)
Recursively expands any environment variable(s) defined within a String. If expansion is not possible, the original string will be returned.- Parameters:
s
- a string possibly containing one or more environment variables- Returns:
- The input string with all environment variables expanded
-
expandVariables
public static java.lang.String expandVariables(java.lang.String s, boolean recursive)
Expands any environment variable(s) defined within a String. If expansion is not possible, the original string will be returned.- Parameters:
s
- a string possibly containing one or more environment variablesrecursive
- whether or not variable values should be expanded recursively- Returns:
- The input string with all environment variables expanded
-
getProcessorCount
public static int getProcessorCount()
-
isSingleProcessor
public static boolean isSingleProcessor()
-
-