public final class SystemUtil extends Object
| Modifier and Type | Method and Description |
|---|---|
static long |
currentTimeMillis()
Gets current time in milliseconds since the epoch (January 1, 1970, 00:00:00 GMT).
|
static long |
getFreeMemory()
Gets free available memory for JDK.
|
static String |
getPropertyOrEnvironmentVariable(String name)
Gets either java property or environment variable with given name.
|
static long |
getRelativeTimeMillis()
Should be used in relative constructs (for example to check how many milliseconds have passed).
|
static int |
getTimeBasedIntSeed()
Gets seed as int value of current time in milliseconds.
|
static long |
getTimeBasedSeed()
Gets seed as long value of current time in milliseconds.
|
static StringBuilder |
runProcessAndCollectErrors(String execPath,
String params)
Executes the specified command and arguments in a separate process with the specified environment and working
directory and returns output errors as a string.
|
static int |
runProcessAndGetExitCode(String exec,
String params)
Executes the specified command and arguments in a separate process with the specified environment and working
directory.
|
static int |
runProcessAndGetExitCode(String exec,
String params,
String workingDirPath)
Executes the specified command and arguments in a separate process with the specified environment and working
directory.
|
static String |
runProcessAndGetOutput(String command,
String params)
Executes the specified command and arguments in a separate process with the specified environment and working
directory and returns output as a string.
|
static ProcessInfo |
runProcessAndGetProcessInfo(String command,
String params)
Executes the specified command and arguments in a separate process with the specified environment and working
directory and returns process info.
|
static boolean |
runProcessAndWait(String exec,
String params)
Executes the specified command and arguments in a separate process with the specified environment and working
directory.
|
static boolean |
runProcessAndWait(String exec,
String params,
String workingDirPath)
Executes the specified command and arguments in a separate process with the specified environment and working
directory.
|
public static long getTimeBasedSeed()
public static int getTimeBasedIntSeed()
public static long getRelativeTimeMillis()
Shouldn't be used in the Date creation since the value returned by this method is different in ะก#.
For getting current time consistently use DateTimeUtil.getCurrentTimeDate().
public static long currentTimeMillis()
public static long getFreeMemory()
public static String getPropertyOrEnvironmentVariable(String name)
name - the name of either java property or environment variable.public static boolean runProcessAndWait(String exec, String params) throws IOException, InterruptedException
exec - a specified system command.params - a parameters for the specifed system command.IOException - if any I/O error occurs.InterruptedException - if process was interrupted.public static boolean runProcessAndWait(String exec, String params, String workingDirPath) throws IOException, InterruptedException
exec - a specified system command.params - a parameters for the specifed system command.workingDirPath - working dir for subprocess.IOException - if any I/O error occurs.InterruptedException - if process was interrupted.public static int runProcessAndGetExitCode(String exec, String params) throws IOException, InterruptedException
exec - a specified system command.params - a parameters for the specifed system command.IOException - if any I/O error occurs.InterruptedException - if process was interrupted.public static int runProcessAndGetExitCode(String exec, String params, String workingDirPath) throws IOException, InterruptedException
exec - a specified system command.params - a parameters for the specifed system command.workingDirPath - working dir for subprocess.IOException - if any I/O error occurs.InterruptedException - if process was interrupted.public static String runProcessAndGetOutput(String command, String params) throws IOException
command - a specified system command.params - a parameters for the specifed system command.IOException - if any I/O error occurs.public static StringBuilder runProcessAndCollectErrors(String execPath, String params) throws IOException
execPath - a specified system command.params - a parameters for the specifed system command.StringBuilder.IOException - if any I/O error occurs.public static ProcessInfo runProcessAndGetProcessInfo(String command, String params) throws IOException, InterruptedException
command - a specified system command.params - a parameters for the specifed system command.IOException - if any I/O error occurs.InterruptedException - if process was interrupted.Copyright © 1998–2025 Apryse Group NV. All rights reserved.