public final class ExecUtil extends Object
ExecException
.Modifier and Type | Field and Description |
---|---|
static String |
STDERR
Identifier for standard error.
|
static String |
STDOUT
Identifier for standard output.
|
Modifier and Type | Method and Description |
---|---|
static int |
watchProcess(Process process)
Watches a running process.
|
static int |
watchProcess(Process process,
IInputStreamListener listener)
Watches a running process.
|
static int |
watchProcess(Process process,
IInputStreamListener[] listeners)
Watches a running process.
|
static int |
watchProcess(Process process,
IInputStreamListener[] outputListeners,
IInputStreamListener[] errorListeners)
Watches a running process.
|
static int |
watchProcess(Process process,
IInputStreamListener outputListener,
IInputStreamListener errorListener)
Watches a running process.
|
static int |
watchProcess(Process process,
InputStream input,
IInputStreamListener[] outputListeners,
IInputStreamListener[] errorListeners)
Watches a running process while sending data to its STDIN.
|
static void |
watchProcessAsync(Process process,
IInputStreamListener[] outputListeners,
IInputStreamListener[] errorListeners)
Watches process output.
|
static void |
watchProcessAsync(Process process,
IInputStreamListener outputListener,
IInputStreamListener errorListener)
Watches process output.
|
static void |
watchProcessAsync(Process process,
InputStream input,
IInputStreamListener[] outputListeners,
IInputStreamListener[] errorListeners)
Watches process output while sending data to its STDIN.
|
public static final String STDOUT
public static final String STDERR
public static int watchProcess(Process process)
InputStreamConsumer
to read its error and output stream.process
- the process to watchpublic static int watchProcess(Process process, IInputStreamListener listener)
InputStreamConsumer
to read its error and output stream.
The listener will be notified every time an error or output line
gets written by the process.
The listener line type will either be "STDERR" or "STDOUT".process
- the process to watchlistener
- the listener to use for both "STDERR" or "STDOUT".public static int watchProcess(Process process, IInputStreamListener[] listeners)
InputStreamConsumer
to read its error and output stream.
The listener will be notified every time an error or output line
gets written by the process.
The listener line type will either be "STDERR" or "STDOUT".process
- the process to watchlisteners
- the listeners to use for both "STDERR" or "STDOUT".public static int watchProcess(Process process, IInputStreamListener outputListener, IInputStreamListener errorListener) throws InterruptedException
InputStreamConsumer
to read its error and output stream.
The listener will be notified every time an error or output line
gets written by the process.
The listener line type will either be "STDERR" or "STDOUT".process
- the process to watchoutputListener
- the process output listenererrorListener
- the process error listenerInterruptedException
- problem while waiting for process to finishpublic static int watchProcess(Process process, IInputStreamListener[] outputListeners, IInputStreamListener[] errorListeners)
InputStreamConsumer
to read its error and output stream.
The listeners will be notified every time an error or output line
gets written by the process.
The listener line type will either be "STDERR" or "STDOUT".process
- the process to watchoutputListeners
- the process output listenerserrorListeners
- the process error listenerspublic static int watchProcess(Process process, InputStream input, IInputStreamListener[] outputListeners, IInputStreamListener[] errorListeners)
InputStreamConsumer
to read its error and output stream.
The listeners will be notified every time an error or output line
gets written by the process.
The listener line type will either be "STDERR" or "STDOUT".process
- the process to watchinput
- input sent to process STDINoutputListeners
- the process output listenerserrorListeners
- the process error listenerspublic static void watchProcessAsync(Process process, IInputStreamListener outputListener, IInputStreamListener errorListener)
watchProcess(
Process, IInputStreamListener, IInputStreamListener)
with the exception of not waiting for the process to complete before
returning.process
- the process on which to watch outputsoutputListener
- the process output listenerserrorListener
- the process error listenerspublic static void watchProcessAsync(Process process, IInputStreamListener[] outputListeners, IInputStreamListener[] errorListeners)
watchProcess(
Process, IInputStreamListener[], IInputStreamListener[])
with the exception of not waiting for the process to complete before
returning.process
- the process on which to watch outputsoutputListeners
- the process output listenerserrorListeners
- the process error listenerspublic static void watchProcessAsync(Process process, InputStream input, IInputStreamListener[] outputListeners, IInputStreamListener[] errorListeners)
watchProcess(Process, InputStream,
IInputStreamListener[], IInputStreamListener[])
with the exception of not waiting for the process to complete before
returning.process
- the process on which to watch outputsinput
- input sent to process STDINoutputListeners
- the process output listenerserrorListeners
- the process error listenersCopyright © 2008–2021 Norconex Inc.. All rights reserved.