public final class ProcessUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
exec(File workingDirectory,
InputStream in,
PrintStream err,
PrintStream out,
String... args)
Executes a program.
|
static String |
exec(File workingDirectory,
PrintStream err,
PrintStream out,
String... args)
Executes a program.
|
public static String exec(File workingDirectory, PrintStream err, PrintStream out, String... args)
workingDirectory
- the directory in which to execute the programerr
- the PrintStream
to print the program's error stream to;
if null is passed, the error goes straight to Nirvana (not the
band, though).out
- the PrintStream
to print the program's output to; if
null is passed, the output will be accumulated into a
String
and returned upon exit.args
- the command-line to execute, split into componentsout
is null, otherwise an
empty String
RuntimeException
- if interrupted or the program failed to execute
successfully.public static String exec(File workingDirectory, InputStream in, PrintStream err, PrintStream out, String... args)
workingDirectory
- the directory in which to execute the programin
- the InputStream
which gets fed to the program as standard input;err
- the PrintStream
to print the program's error stream to;
if null is passed, the error goes straight to Nirvana (not the
band, though).out
- the PrintStream
to print the program's output to; if
null is passed, the output will be accumulated into a
String
and returned upon exit.args
- the command-line to execute, split into componentsout
is null, otherwise an
empty String
RuntimeException
- if interrupted or the program failed to execute
successfully.Copyright © 2015–2022 SciJava. All rights reserved.