public class SystemUtils extends Object
Constructor and Description |
---|
SystemUtils() |
Modifier and Type | Method and Description |
---|---|
static void |
destroy(Process pd,
Thread[] streamThread)
Calls destroy on the process in order to guarantee release of resources
in underlying platform.
|
static void |
doExec(List<String> command,
String[] env,
File dir,
boolean wait,
StringBuffer stdout,
StringBuffer stderr)
Execs command directly.
|
static void |
join(Thread thread)
Safety feature: checks to make sure the calling thread is not the thread
on which the join is called, to avoid deadlock.
|
static Thread |
streamConsumer(InputStreamReader reader,
boolean err,
StringBuffer output)
Creates thread which consumes the stream by reading and appending to
buffer
|
public static final Random random
public static void doExec(List<String> command, String[] env, File dir, boolean wait, StringBuffer stdout, StringBuffer stderr) throws IOException
command
- env
- dir
- wait
- IOException
public static void join(Thread thread)
thread
- to join on.public static void destroy(Process pd, Thread[] streamThread)
pd
- processstreamThreads
- of the stream consumerspublic static Thread streamConsumer(InputStreamReader reader, boolean err, StringBuffer output)
reader
- for the input streamerr
- if true, stream is an error stream.output
- of streamCopyright © 2017. All rights reserved.