public final class ProcessTools extends Object
| Modifier and Type | Class and Description |
|---|---|
static interface |
ProcessTools.IFollow |
static class |
ProcessTools.StreamCopyThread
This is used to async read strout and stderr streams from a process into another output stream.
|
static class |
ProcessTools.StreamReaderThread
This is used to async read strout and stderr streams from a process...
|
| Constructor and Description |
|---|
ProcessTools() |
ProcessTools(ProcessBuilder pb) |
| Modifier and Type | Method and Description |
|---|---|
ProcessTools |
add(List<String> cmd) |
ProcessTools |
add(String... args) |
ProcessTools |
add(String cmd) |
ProcessTools |
directory(File cmd) |
static int |
dumpStreams(Process pr,
Appendable iosb)
Waits for completion of the command and collect data into the streams.
|
Map<String,String> |
env() |
ProcessTools |
envStrip(String... names) |
ProcessTools |
flush() |
ProcessTools |
follow(ProcessTools.IFollow cmd) |
int |
run() |
static int |
runProcess(ProcessBuilder pb,
Appendable sb)
Runs the process whose data is in the ProcessBuilder and captures the result with stdout and stderr merged.
|
static int |
runProcess(ProcessBuilder pb,
Appendable outsb,
Appendable errsb)
Runs the process whose data is in the ProcessBuilder and captures the result with stdout and stderr merged.
|
static int |
runProcess(ProcessBuilder pb,
OutputStream stdout,
Appendable stderrsb)
Runs the process whose data is in the ProcessBuilder and captures the result.
|
static int |
runProcess(ProcessBuilder pb,
Writer out)
Runs the process whose data is in the ProcessBuilder and captures the
result with stdout and stderr merged into a writer.
|
ProcessTools |
setCommand(List<String> cmd) |
ProcessTools |
stderr(Writer stderr) |
ProcessTools |
stdout(Writer stdout) |
public ProcessTools()
public ProcessTools(@Nonnull ProcessBuilder pb)
@Nonnull public ProcessTools stdout(@Nonnull Writer stdout)
@Nonnull public ProcessTools stderr(@Nonnull Writer stderr)
@Nonnull public ProcessTools add(@Nonnull String cmd)
@Nonnull public ProcessTools add(@Nonnull List<String> cmd)
@Nonnull public ProcessTools add(String... args)
@Nonnull public ProcessTools setCommand(@Nonnull List<String> cmd)
@Nonnull public ProcessTools directory(@Nonnull File cmd)
@Nonnull public ProcessTools follow(@Nonnull ProcessTools.IFollow cmd)
@Nonnull public ProcessTools flush()
@Nonnull public ProcessTools envStrip(@Nonnull String... names)
public static int dumpStreams(Process pr, Appendable iosb) throws Exception
Exceptionpublic static int runProcess(ProcessBuilder pb, Appendable sb) throws Exception
pb - sb - Exceptionpublic static int runProcess(ProcessBuilder pb, OutputStream stdout, Appendable stderrsb) throws Exception
pb - sb - Exceptionpublic static int runProcess(ProcessBuilder pb, Appendable outsb, Appendable errsb) throws Exception
pb - sb - Exceptionpublic static int runProcess(ProcessBuilder pb, Writer out) throws Exception
pb - sb - ExceptionCopyright © 2017 etc.to. All rights reserved.