Class ExecUtil
java.lang.Object
de.tomatengames.util.ExecUtil
-
Method Summary
Modifier and TypeMethodDescriptionstatic ExecGetResultStarts a process usingRuntime.exec(String[]), and waits for the process to terminate.static ExecGetResultStarts a process usingRuntime.exec(String[], String[], File), and waits for the process to terminate.static StringexecGetOutput(String... cmd) Starts a process usingRuntime.exec(String[]), and waits for the process to terminate.static StringexecGetOutput(String[] cmd, String[] envp, File dir) Starts a process usingRuntime.exec(String[], String[], File), and waits for the process to terminate.
-
Method Details
-
execGet
public static ExecGetResult execGet(String[] cmd, String[] envp, File dir, byte[] input) throws IOException Starts a process usingRuntime.exec(String[], String[], File), and waits for the process to terminate. Meanwhile, the standard output and the error output of the process are read into memory.- Parameters:
cmd- The command to call and its arguments. Must not benull.envp- Environment variables in the format specified byRuntime.exec(String[], String[], File). May benull.dir- The working directory of the subprocess. May benull.input- Bytes to write to the standard input of the subprocess. May benull.- Returns:
- An result object containing the standard output of the subprocess, the exit value, ...
- Throws:
IOException- If an error occurs.
-
execGet
Starts a process usingRuntime.exec(String[]), and waits for the process to terminate. Meanwhile, the standard output and the error output of the process are read into memory.- Parameters:
cmd- The command to call and its arguments. Must not benull.- Returns:
- An result object containing the standard output of the process, the exit value, ...
- Throws:
IOException- If an error occurs.
-
execGetOutput
Starts a process usingRuntime.exec(String[], String[], File), and waits for the process to terminate. Meanwhile, the standard output and the error output of the process are read into memory. The exit value of the process must be0.- Parameters:
cmd- The command to call and its arguments. Must not benull.envp- Environment variables in the format specified byRuntime.exec(String[], String[], File). May benull.dir- The working directory of the subprocess. May benull.- Returns:
- The standard output as String.
- Throws:
IOException- If an error occurs or the exit value of the process is not0.- See Also:
-
execGetOutput
Starts a process usingRuntime.exec(String[]), and waits for the process to terminate. Meanwhile, the standard output and the error output of the process are read into memory. The exit value of the process must be0.- Parameters:
cmd- The command to call and its arguments. Must not benull.- Returns:
- The standard output as String.
- Throws:
IOException- If an error occurs or the exit value of the process is not0.- See Also:
-