public interface Executable
Modifier and Type | Interface and Description |
---|---|
static interface |
Executable.StdHandler
Receives output for stderr or stdout.
|
Modifier and Type | Field and Description |
---|---|
static int |
TIMED_OUT
Exit value if the execution timed out.
|
Modifier and Type | Method and Description |
---|---|
void |
addArguments(java.lang.Object... args)
Add additional arguments.
|
void |
addOptions(java.lang.Object... opts)
Add the executable options.
|
java.util.Map<java.lang.String,java.lang.String> |
environment()
Get the current environment map
|
int |
exec()
run the executable.
|
java.lang.Object[] |
getArguments()
Get the executables arguments
|
java.lang.String |
getName()
Get the name of the executable.
|
java.lang.Object[] |
getOptions()
Get the executable options.
|
void |
redirectDefaults()
redirect to default files and append.
|
void |
redirectError(java.lang.String filename)
Redirect stderr to a file in the workspace.
|
void |
redirectError(java.io.StringWriter w)
Redirect the error stream to a string writer
|
void |
redirectOutput(java.lang.String filename)
Redirect stdout to a file in the workspace.
|
void |
redirectOutput(java.io.StringWriter w)
Redirect the output to a string writer
|
void |
setArguments(java.lang.Object... args)
Set the executable arguments.
|
void |
setOptions(java.lang.Object... opts)
Set the executable options.
|
void |
setStderrHandler(Executable.StdHandler handler)
Handle the current output from stderr.
|
void |
setStdoutHandler(Executable.StdHandler handler)
Handle the current output from stdout.
|
void |
setTimeout(long time,
java.util.concurrent.TimeUnit unit)
Set the timeout.
|
java.io.File |
stderr()
Get the File for stderr.
|
java.io.File |
stdout()
Get the File for stdio.
|
static final int TIMED_OUT
java.lang.String getName()
void addOptions(java.lang.Object... opts)
opts
- the executable optionsvoid setOptions(java.lang.Object... opts)
opts
- the executable optionsjava.lang.Object[] getOptions()
void setArguments(java.lang.Object... args)
args
- the executable argumentsvoid addArguments(java.lang.Object... args)
args
- the command line arguments.java.lang.Object[] getArguments()
java.util.Map<java.lang.String,java.lang.String> environment()
void redirectOutput(java.lang.String filename) throws java.io.IOException
filename
- the filename to use relative to the workspace.java.io.IOException
- if redirection fails.void redirectOutput(java.io.StringWriter w) throws java.io.IOException
w
- the StringWriterjava.io.IOException
- if redirection fails.void redirectError(java.lang.String filename) throws java.io.IOException
filename
- the filename to use relative to the workspace.java.io.IOException
- if redirection fails.void redirectError(java.io.StringWriter w) throws java.io.IOException
w
- the StringWriterjava.io.IOException
- if redirection failsvoid redirectDefaults() throws java.io.IOException
java.io.IOException
- if redirection failsvoid setTimeout(long time, java.util.concurrent.TimeUnit unit)
time
- the amount of the time unit.unit
- the TimeUnitint exec() throws java.io.IOException
java.io.IOException
- if an IO error occurs.java.io.File stdout()
java.io.File stderr()
void setStdoutHandler(Executable.StdHandler handler)
handler
- the handler object. Pass 'null' for removing an existing
handler.void setStderrHandler(Executable.StdHandler handler)
handler
- the handler object. Pass 'null' for removing an existing
handler.(c) 2012-2022, OMSLab, Colorado State University.