|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjlibs.core.lang.RuntimeUtil
public class RuntimeUtil
The class contains Runtime related utilities
| Constructor Summary | |
|---|---|
RuntimeUtil()
|
|
| Method Summary | |
|---|---|
static void |
gc()
This method guarantees that garbage collection is done unlike |
static void |
gc(int count)
calls count times |
static void |
gcOnExit()
This method guarantees that garbage colleciton is done after JVM shutdown is initialized |
static String |
getPID()
Returns the PID of the current process. |
static void |
redirectStreams(Process process,
OutputStream output,
OutputStream error)
Redirects given process's input and error streams to the specified streams. |
static String |
runCommand(String command)
Runs the specified command in terminal (sh in *nix/cmd in windows) and
returns the command output. |
static String |
runCommand(String command,
String[] envp,
File workingDir)
Runs the specified command in terminal (sh in *nix/cmd in windows) and
returns the command output. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RuntimeUtil()
| Method Detail |
|---|
public static void redirectStreams(Process process,
OutputStream output,
OutputStream error)
process - process whose streams to be redirectedoutput - outputStream to which process's inputStream is redirected.error - outputStream to which process's errorStream is redirected.
public static String runCommand(String command,
String[] envp,
File workingDir)
throws IOException
command in terminal (sh in *nix/cmd in windows) and
returns the command output.
command - complete command to be executedenvp - array of strings, each element of which
has environment variable settings in the format
name=value, or
null if the subprocess should inherit
the environment of the current process.workingDir - the working directory of the subprocess, or
null if the subprocess should inherit
the working directory of the current process.
IOException - If an I/O error occursrunCommand(String)
public static String runCommand(String command)
throws IOException
command in terminal (sh in *nix/cmd in windows) and
returns the command output. The subprocess created inherits environment and working
directory from the current process
command - complete command to be executed
IOException - If an I/O error occursrunCommand(String, String[], java.io.File)
public static String getPID()
throws IOException
"pid"
IOException - If an I/O error occurspublic static void gc()
System.gc()
public static void gc(int count)
gc() count times
public static void gcOnExit()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||