org.apache.jorphan.exec

## Class SystemCommand

- java.lang.Object
- - org.apache.jorphan.exec.SystemCommand

-     public class SystemCommand
      extends java.lang.Object

  Utility class for invoking native system applications

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `POLL_INTERVAL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SystemCommand(java.io.File directory, long timeoutMillis, int pollInterval, java.util.Map<java.lang.String,java.lang.String> env, java.io.InputStream stdin, java.io.OutputStream stdout, java.io.OutputStream stderr)`
    `SystemCommand(java.io.File directory, long timeoutMillis, int pollInterval, java.util.Map<java.lang.String,java.lang.String> env, java.lang.String stdin, java.lang.String stdout, java.lang.String stderr)`
    `SystemCommand(java.io.File directory, java.util.Map<java.lang.String,java.lang.String> env)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.util.Map<java.lang.String,java.lang.String>` | `getExecutionEnvironment()`
    `java.lang.String` | `getOutResult()`
    `int` | `run(java.util.List<java.lang.String> arguments)`
    `int` | `run(java.util.List<java.lang.String> arguments1, java.util.List<java.lang.String> arguments2)` Pipe the output of one command into another

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

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

- - ### Field Detail

    - #### POLL_INTERVAL

          public static final int POLL_INTERVAL

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SystemCommand

          public SystemCommand(java.io.File directory,
                               java.util.Map<java.lang.String,java.lang.String> env)

      Parameters:
        `env` - Environment variables appended to environment (may be null)
        `directory` - File working directory (may be null)

    - #### SystemCommand

          public SystemCommand(java.io.File directory,
                               long timeoutMillis,
                               int pollInterval,
                               java.util.Map<java.lang.String,java.lang.String> env,
                               java.lang.String stdin,
                               java.lang.String stdout,
                               java.lang.String stderr)
                        throws java.io.IOException

      Parameters:
        `env` - Environment variables appended to environment (may be null)
        `directory` - File working directory (may be null)
        `timeoutMillis` - timeout in Milliseconds
        `pollInterval` - Value used to poll for Process execution end
        `stdin` - File name that will contain data to be input to process (may be null)
        `stdout` - File name that will contain out stream (may be null)
        `stderr` - File name that will contain err stream (may be null)
      Throws:
        `java.io.IOException` - if the input file is not found or output cannot be written

    - #### SystemCommand

          public SystemCommand(java.io.File directory,
                               long timeoutMillis,
                               int pollInterval,
                               java.util.Map<java.lang.String,java.lang.String> env,
                               java.io.InputStream stdin,
                               java.io.OutputStream stdout,
                               java.io.OutputStream stderr)

      Parameters:
        `env` - Environment variables appended to environment (may be null)
        `directory` - File working directory (may be null)
        `timeoutMillis` - timeout in Milliseconds
        `pollInterval` - Value used to poll for Process execution end
        `stdin` - File name that will contain data to be input to process (may be null)
        `stdout` - File name that will contain out stream (may be null)
        `stderr` - File name that will contain err stream (may be null)

  - ### Method Detail

    - #### run

          public int run(java.util.List<java.lang.String> arguments)
                  throws java.lang.InterruptedException,
                         java.io.IOException

      Parameters:
        `arguments` - List of strings, not null
      Returns:
        return code
      Throws:
        `java.lang.InterruptedException` - when execution was interrupted
        `java.io.IOException` - when I/O error occurs while execution

    - #### run

          public int run(java.util.List<java.lang.String> arguments1,
                         java.util.List<java.lang.String> arguments2)
                  throws java.lang.InterruptedException,
                         java.io.IOException

      Pipe the output of one command into another
      Parameters:
        `arguments1` - first command to run
        `arguments2` - second command to run
      Returns:
        exit status
      Throws:
        `java.lang.InterruptedException` - when execution gets interrupted
        `java.io.IOException` - when I/O error occurs while execution

    - #### getOutResult

          public java.lang.String getOutResult()

      Returns:
        Out/Err stream contents

    - #### getExecutionEnvironment

          public java.util.Map<java.lang.String,java.lang.String> getExecutionEnvironment()

      Returns:
        the executionEnvironment

Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.