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.StringARCH_DATA_MODELprivate static java.util.logging.Loggerloggerprivate static java.lang.StringOS_ARCHprivate static java.lang.StringOS_NAMEprivate static java.lang.StringOS_NAME_LOWERprivate static java.util.regex.PatternVARIABLE_PATTERN
-
Constructor Summary
Constructors Modifier Constructor Description privateEnvironment()Make sure nobody can instantiate the class
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.StringexpandVariables(java.lang.String s)Recursively expands any environment variable(s) defined within a String.static java.lang.StringexpandVariables(java.lang.String s, boolean recursive)Expands any environment variable(s) defined within a String.static intgetProcessorCount()static java.lang.StringgetVariable(java.lang.String variable)Get any variable by name if defined on the systemstatic booleanis32Bit()static booleanis64Bit()static booleanisAmd64()static booleanisFileSystemCaseSensitive()static booleanisLinux()static booleanisMac()static booleanisMacX64()static booleanisOS2()static booleanisSingleProcessor()static booleanisUnix()static booleanisWindows()
-
-
-
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()
-
-