Package de.uplanet.util
Class ExecWrapper
- java.lang.Object
-
- de.uplanet.util.ExecWrapper
-
@Scriptable public final class ExecWrapper extends Object
Wrap child processes. Note: this class is not thread-safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ExecWrapper.TimeoutException
-
Constructor Summary
Constructors Constructor Description ExecWrapper(String... p_params)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
exec()
Executes the process.int
exec(long p_lTimeout, TimeUnit p_timeUnit)
Executes the process and waits for termination until the given timeout has been reached.String
getStdErr()
Get the error output of the child process.String
getStdOut()
Get the standard output of the child process.
-
-
-
Constructor Detail
-
ExecWrapper
public ExecWrapper(String... p_params)
-
-
Method Detail
-
exec
public int exec() throws IOException, InterruptedException
Executes the process. Waits indeterminately until the prcess terminates.- Returns:
- The exit code of the child process.
- Throws:
IOException
- if any occursInterruptedException
- if any occurs
-
exec
public int exec(long p_lTimeout, TimeUnit p_timeUnit) throws IOException, InterruptedException, ExecWrapper.TimeoutException
Executes the process and waits for termination until the given timeout has been reached.- Parameters:
p_lTimeout
- timeout value to wait for the process to terminate.p_timeUnit
- timeunit of the time out value- Returns:
- The exit code of the child process
- Throws:
IOException
- if any occursInterruptedException
- if any occursExecWrapper.TimeoutException
- if any occurs
-
getStdOut
public String getStdOut()
Get the standard output of the child process.- Returns:
- The stdout output of the child process, or
null
if there was no such output.
-
getStdErr
public String getStdErr()
Get the error output of the child process.- Returns:
- The stderr output of the child process, or
null
if there was no such output.
-
-