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.
  • Constructor Details

    • ExecWrapper

      public ExecWrapper(String... p_params)
  • Method Details

    • 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 occurs
      InterruptedException - 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 occurs
      InterruptedException - if any occurs
      ExecWrapper.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.