Class WrapperProcess


  • public class WrapperProcess
    extends Object
    A WrapperProcess is returned by a call to WrapperManager.exec and can be used to reference the new child process after it was launched.
    Since:
    Wrapper 3.4.0
    Author:
    Tanuki Software Development Team <support@tanukisoftware.com>
    • Method Detail

      • getPID

        public int getPID()
        Returns the PID of the process.
        Returns:
        The PID of the process.
      • getInputStream

        public InputStream getInputStream()
                                   throws IOException
        Gets the input stream of the subprocess. The stream obtains data piped from the standard output stream of the process represented by this WrapperProcess object.

        This is an alias of the getStdOut() method.

        Implementation note: It is a good idea for the input stream to be buffered.

        Returns:
        The input stream connected to the normal output of the subprocess.
        Throws:
        IOException - If we are unable to access the stream.
      • getStdOut

        public InputStream getStdOut()
                              throws IOException
        Gets the input stream of the subprocess. The stream obtains data piped from the standard output stream of the process represented by this WrapperProcess object.

        This is an alias of the getInputStream() method.

        Implementation note: It is a good idea for the input stream to be buffered.

        Returns:
        The input stream connected to the normal output of the subprocess.
        Throws:
        IOException - If we are unable to access the stream.
      • getErrorStream

        public InputStream getErrorStream()
                                   throws IOException
        Gets the error stream of the subprocess. The stream obtains data piped from the error output stream of the process represented by this WrapperProcess object.

        This is an alias of the getStdErr() method.

        Implementation note: It is a good idea for the input stream to be buffered.

        Returns:
        The input stream connected to the error stream of the subprocess.
        Throws:
        IOException - If we are unable to access the stream.
      • getStdErr

        public InputStream getStdErr()
                              throws IOException
        Gets the error stream of the subprocess. The stream obtains data piped from the error output stream of the process represented by this WrapperProcess object.

        This is an alias of the getErrorStream() method.

        Implementation note: It is a good idea for the input stream to be buffered.

        Returns:
        The input stream connected to the error stream of the subprocess.
        Throws:
        IOException - If we are unable to access the stream.
      • getOutputStream

        public OutputStream getOutputStream()
                                     throws IOException
        Gets the output stream of the subprocess. Output to the stream is piped into the standard input stream of the process represented by this WrapperProcess object.

        This is an alias of the getStdIn() method.

        Implementation note: It is a good idea for the output stream to be buffered.

        Returns:
        The output stream connected to the normal input of the subprocess.
        Throws:
        IOException - If we are unable to access the stream.
      • getStdIn

        public OutputStream getStdIn()
                              throws IOException
        Gets the output stream of the subprocess. Output to the stream is piped into the standard input stream of the process represented by this WrapperProcess object.

        This is an alias of the getOutputStream() method.

        Implementation note: It is a good idea for the output stream to be buffered.

        Returns:
        The output stream connected to the normal input of the subprocess.
        Throws:
        IOException - If we are unable to access the stream.
      • waitFor

        public int waitFor()
                    throws InterruptedException
        Causes the current thread to wait, if necessary, until the process represented by this Process object has terminated. This method returns immediately if the subprocess has already terminated. If the subprocess has not yet terminated, the calling thread will be blocked until the subprocess exits.
        Returns:
        The exit value of the process. By convention, 0 indicates normal termination.
        Throws:
        InterruptedException - If the current thread is interrupted by another thread while it is waiting, then the wait is ended and an InterruptedException is thrown.
      • exitValue

        public int exitValue()
                      throws IllegalThreadStateException
        Returns the exit value for the subprocess.
        Returns:
        The exit value of the subprocess represented by this WrapperProcess object. By convention, the value 0 indicates normal termination.
        Throws:
        IllegalThreadStateException - if the process is still alive and has not yet teminated.
      • isAlive

        public boolean isAlive()
        Returns true if the process is still alive.
        Returns:
        True if the process is alive, false if it has terminated.
        Throws:
        WrapperLicenseError - If the function is called other than in the Professional Edition or from a Standalone JVM.
      • destroy

        public void destroy()
        Kills the subprocess. The subprocess represented by this Process object is forcibly terminated if it is still running.
        Throws:
        WrapperLicenseError - If the function is called other than in the Professional Edition or from a Standalone JVM.