util.io

## Class ExecutionHandler

- java.lang.Object
- - util.io.ExecutionHandler

-     public class ExecutionHandler
      extends java.lang.Object

  Handles the execution of external processes.
  Since:
    2.6.1/2.2.5
  Author:
    René Mach

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExecutionHandler(java.lang.String[] parameterWithProgramPath)` Creates an instance of this class.
    `ExecutionHandler(java.lang.String[] parameterWithProgramPath, java.io.File runtimeDirectory)` Creates an instance of this class.
    `ExecutionHandler(java.lang.String[] parameterWithProgramPath, java.lang.String runtimeDirectory)` Creates an instance of this class.
    `ExecutionHandler(java.lang.String parameter, java.lang.String programPath)` Creates an instance of this class.
    `ExecutionHandler(java.lang.String parameter, java.lang.String programPath, java.io.File runtimeDirectory)` Creates an instance of this class.
    `ExecutionHandler(java.lang.String parameter, java.lang.String programPath, java.lang.String runtimeDirectory)` Creates an instance of this class.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `execute()` Executes the given application with the given parameters in the given runtime directory.
    `void` | `execute(boolean logInputStream)` Executes the given application with the given parameters in the given runtime directory.
    `void` | `execute(boolean logInputStream, boolean logErrorStream)` Executes the given application with the given parameters in the given runtime directory.
    `void` | `execute(boolean logInputStream, boolean logErrorStream, java.lang.String encoding)` Executes the given application with the given parameters in the given runtime directory.
    `void` | `execute(boolean logInputStream, java.lang.String encoding)` Executes the given application with the given parameters in the given runtime directory.
    `void` | `execute(java.lang.String encoding)` Executes the given application with the given parameters in the given runtime directory.
    `int` | `exitValue()` The exit value of the process.
    `java.lang.String` | `getErrors()` Get error output of the execution handler after execution
    `StreamReaderThread` | `getErrorStreamReaderThread()` Gets the error stream reader thread.
    `StreamReaderThread` | `getInputStreamReaderThread()` Gets the input stream reader thread (it logs the console output of the process).
    `java.lang.String` | `getOutput()` get console output of the execution handler after execution
    `java.lang.Process` | `getProcess()` Gets the started process.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ExecutionHandler

          public ExecutionHandler(java.lang.String parameter,
                          java.lang.String programPath)

      Creates an instance of this class.
      Parameters:
        `parameter` - The parameter to pass to the application.
        `programPath` - The path to the application.

    - #### ExecutionHandler

          public ExecutionHandler(java.lang.String parameter,
                          java.lang.String programPath,
                          java.lang.String runtimeDirectory)

      Creates an instance of this class.
      Parameters:
        `parameter` - The parameter to parse to the application.
        `programPath` - The path to the application.
        `runtimeDirectory` - The runtime directory for the application.

    - #### ExecutionHandler

          public ExecutionHandler(java.lang.String parameter,
                          java.lang.String programPath,
                          java.io.File runtimeDirectory)

      Creates an instance of this class.
      Parameters:
        `parameter` - The parameter to parse to the application.
        `programPath` - The path to the application.
        `runtimeDirectory` - The runtime directory for the application.

    - #### ExecutionHandler

          public ExecutionHandler(java.lang.String[] parameterWithProgramPath)

      Creates an instance of this class.
      Parameters:
        `parameterWithProgramPath` - The parameter to parse to the application with the path to the program.

    - #### ExecutionHandler

          public ExecutionHandler(java.lang.String[] parameterWithProgramPath,
                          java.lang.String runtimeDirectory)

      Creates an instance of this class.
      Parameters:
        `parameterWithProgramPath` - The parameter to parse to the application with the path to the program.
        `runtimeDirectory` - The runtime directory for the application.

    - #### ExecutionHandler

          public ExecutionHandler(java.lang.String[] parameterWithProgramPath,
                          java.io.File runtimeDirectory)

      Creates an instance of this class.
      Parameters:
        `parameterWithProgramPath` - The parameter to parse to the application with the path to the program.
        `runtimeDirectory` - The runtime directory for the application.

  - ### Method Detail

    - #### execute

          public void execute()
                       throws java.io.IOException

      Executes the given application with the given parameters in the given runtime directory.
      Throws:
        `java.io.IOException` - Thrown if something went wrong on process building.

    - #### execute

          public void execute(java.lang.String encoding)
                       throws java.io.IOException

      Executes the given application with the given parameters in the given runtime directory.
      Parameters:
        `encoding` - The encoding for the reading of the process console output.
      Throws:
        `java.io.IOException` - Thrown if something went wrong on process building.

    - #### execute

          public void execute(boolean logInputStream)
                       throws java.io.IOException

      Executes the given application with the given parameters in the given runtime directory.
      Parameters:
        `logInputStream` - `True` means that the console output of the output stream of the process will be logged and can be get after the process was stopped (it's output stream is an input stream for the process starter).
      Throws:
        `java.io.IOException` - Thrown if something went wrong on process building.

    - #### execute

          public void execute(boolean logInputStream,
                     java.lang.String encoding)
                       throws java.io.IOException

      Executes the given application with the given parameters in the given runtime directory.
      Parameters:
        `logInputStream` - `True` means that the console output of the output stream of the process will be logged and can be get after the process was stopped (it's output stream is an input stream for the process starter).
        `encoding` - The encoding for the reading of the process console output.
      Throws:
        `java.io.IOException` - Thrown if something went wrong on process building.

    - #### execute

          public void execute(boolean logInputStream,
                     boolean logErrorStream)
                       throws java.io.IOException

      Executes the given application with the given parameters in the given runtime directory.
      Parameters:
        `logInputStream` - `True` means that the console output of the output stream of the process will be logged and can be get after the process was stopped (it's output stream is an input stream for the process starter).
        `logErrorStream` - `True` means that the console output of the error stream of the process will be logged and can be get after the process was stopped.
      Throws:
        `java.io.IOException` - Thrown if something went wrong on process building.

    - #### execute

          public void execute(boolean logInputStream,
                     boolean logErrorStream,
                     java.lang.String encoding)
                       throws java.io.IOException

      Executes the given application with the given parameters in the given runtime directory.
      Parameters:
        `logInputStream` - `True` means that the console output of the output stream of the process will be logged and can be get after the process was stopped (it's output stream is an input stream for the process starter).
        `logErrorStream` - `True` means that the console output of the error stream of the process will be logged and can be get after the process was stopped.
        `encoding` - The encoding for the reading of the process console output.
      Throws:
        `java.io.IOException` - Thrown if something went wrong on process building.

    - #### getProcess

          public java.lang.Process getProcess()

      Gets the started process.
      Returns:
        The started process or `null` if the process wasn't started.

    - #### exitValue

          public int exitValue()
                        throws java.lang.IllegalThreadStateException

      The exit value of the process.
      Returns:
        The exit value of the process.
      Throws:
        `java.lang.IllegalThreadStateException` - Thrown if the process wasn't started or is not finished.

    - #### getInputStreamReaderThread

          public StreamReaderThread getInputStreamReaderThread()

      Gets the input stream reader thread (it logs the console output of the process).
      Returns:
        The input stream reader thread.

    - #### getErrorStreamReaderThread

          public StreamReaderThread getErrorStreamReaderThread()

      Gets the error stream reader thread.
      Returns:
        The error stream reader thread.

    - #### getOutput

          public java.lang.String getOutput()

      get console output of the execution handler after execution
      Returns:
        output
      Since:
        3.0

    - #### getErrors

          public java.lang.String getErrors()

      Get error output of the execution handler after execution
      Returns:
        The errors
      Since:
        3.0.2

TV-Browser 3.4.3, Copyright (C) 2004-2008 TV-Browser Team (dev@tvbrowser.org)