public final class SystemUtility extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
exec(String aCommand)
Executes a command and returns the output.
|
static CommandLineInterpreter |
getCommandLineInterpreter()
Tries to determine the command line interpreter (CLI) - if any - this
process is running in, e.g. whether we are running in a DOS console
environment or a Linux alike Shell.
|
static String |
getComputerName()
Determines the computer's name.
|
static int |
getConsoleHeight()
Determines the height in characters of the system's console in use.
|
static int |
getConsoleWidth()
Determines the width in characters of the system's console in use.
|
static String |
getLineBreak()
Determines the operating system as of
getOperatingSystem() and
in case a OperatingSystem.WINDOWS is being detected, then \r\n"
(CRLF) is returned, else "\n" (LF) is returned. |
static OperatingSystem |
getOperatingSystem()
Determines the operating system your application is currently running on.
|
static String |
getSystemEncoding()
Determines the encoding of the system (system's console) in use as of
System.out. |
static File |
getTempDir()
Returns the operating saystem's temp folder.
|
static String |
getUname()
If on a *nix alike system, this method returns the output of the
"uname -a" command: "uname" prints system information, "-a" instructs it
to print all information.
|
static boolean |
isAnsiSupported()
Determines whether ANSI escape sequences are supported by the console.
|
public static OperatingSystem getOperatingSystem()
OperatingSystem being detected.public static String getLineBreak()
getOperatingSystem() and
in case a OperatingSystem.WINDOWS is being detected, then \r\n"
(CRLF) is returned, else "\n" (LF) is returned.public static String getComputerName()
InetAddress, if it fails it tries to get it from the system's
environment using the SystemConsts.ENV_VAR_WIN_COMPUTERNAME (on
Windows machines only) and if both fails, it returns the default
QueryConsts.NAME_LOCALHOST identifier.SystemConsts.NAME_LOCALHOST ("localhost") is returned.public static String getUname()
public static CommandLineInterpreter getCommandLineInterpreter()
CommandLineInterpreter.WIN_CMD is returned
(for example).public static int getConsoleWidth()
RuntimeConsts.MAX_CONSOLE_WIDTH,
RuntimeConsts.NORM_CONSOLE_WIDTH or
RuntimeConsts.MIN_CONSOLE_WIDTHpublic static int getConsoleHeight()
RuntimeConsts.MAX_CONSOLE_HEIGHT,
RuntimeConsts.NORM_CONSOLE_HEIGHT or
RuntimeConsts.MIN_CONSOLE_HEIGHTpublic static String exec(String aCommand)
String stands fur successful execution.public static boolean isAnsiSupported()
public static File getTempDir()
public static String getSystemEncoding()
System.out.Copyright © 2015. All rights reserved.