public class SystemCommand
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
POLL_INTERVAL |
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) |
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
|
public static final int POLL_INTERVAL
public SystemCommand(java.io.File directory, java.util.Map<java.lang.String,java.lang.String> env)
env
- Environment variables appended to environment (may be null)directory
- File working directory (may be null)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
env
- Environment variables appended to environment (may be null)directory
- File working directory (may be null)timeoutMillis
- timeout in MillisecondspollInterval
- Value used to poll for Process execution endstdin
- 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)java.io.IOException
- if the input file is not found or output cannot be writtenpublic 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)
env
- Environment variables appended to environment (may be null)directory
- File working directory (may be null)timeoutMillis
- timeout in MillisecondspollInterval
- Value used to poll for Process execution endstdin
- 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)public int run(java.util.List<java.lang.String> arguments) throws java.lang.InterruptedException, java.io.IOException
arguments
- List of strings, not nulljava.lang.InterruptedException
- when execution was interruptedjava.io.IOException
- when I/O error occurs while executionpublic int run(java.util.List<java.lang.String> arguments1, java.util.List<java.lang.String> arguments2) throws java.lang.InterruptedException, java.io.IOException
arguments1
- first command to runarguments2
- second command to runjava.lang.InterruptedException
- when execution gets interruptedjava.io.IOException
- when I/O error occurs while executionpublic java.lang.String getOutResult()
public java.util.Map<java.lang.String,java.lang.String> getExecutionEnvironment()
Copyright © 1998-2019 Apache Software Foundation. All Rights Reserved.