public final class ProcessUtils extends Object
Modifier and Type | Method and Description |
---|---|
static String |
exec(String command)
Run the specified command and return it's output as a string.
|
static String |
exec(String[] command)
Run the specified command and return it's output as a string.
|
static String |
exec(String[] command,
String cwd)
Run the specified command and return it's output as a string.
|
static String |
exec(String command,
String cwd)
Run the specified command and return it's output as a string.
|
static BufferedReader |
execute(String command)
Launch a process and return a buffered reader ready to consume its
output.
|
static BufferedReader |
execute(String[] command,
String cwd)
Launch a process and return a buffered reader ready to consume its
output.
|
static BufferedReader |
execute(String command,
String cwd)
Launch a process and return a buffered reader ready to consume its
output.
|
static int |
executeShellCmd(String command) |
static BufferedReader |
open(String file)
Open the system default editor on the specified file.
|
static String |
slurp(BufferedReader br)
Consume the output of a command from the given buffered reader.
|
public static BufferedReader open(String file)
file
- path of the file which should be openpublic static BufferedReader execute(String command, String cwd)
command
- command to be executedcwd
- path to the current working directory in which to launch the
subprocesspublic static BufferedReader execute(String[] command, String cwd)
command
- array of command arguments to be executedcwd
- path to the current working directory in which to launch the
subprocesspublic static BufferedReader execute(String command)
command
- command to be executedpublic static String exec(String command)
command
- command to be executedpublic static String exec(String[] command)
command
- array of command arguments to be executedpublic static String exec(String[] command, String cwd)
command
- array of command arguments to be executedcwd
- path to the current working directory in which to launch the
subprocesspublic static String exec(String command, String cwd)
command
- command to be executedcwd
- path to the current working directory in which to launch the
subprocesspublic static int executeShellCmd(String command)
public static String slurp(BufferedReader br)
br
- buffered reader containing output of a commandCopyright © 2015. All Rights Reserved.