Package org.snpeff.osCmd
Class ExecuteOsCommand
java.lang.Object
java.lang.Thread
org.snpeff.osCmd.ExecuteOsCommand
Launches an 'OS command' (e.g. "ls", "dir")
Note: Launching a system command in Java is not trivial, we need to start 2 threads that read STDOUT and STDERR of
the process, otherwise it will block (actually it may even cause a deadlock)
References: http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html?page=1
- Author:
- pcingola
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
FieldsFields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
exec()
String[]
int
getHead()
First lines of stdoutFirst lines of stderrint
getPwd()
getStdin()
boolean
boolean
boolean
boolean
boolean
isQuiet()
boolean
boolean
void
kill()
void
progress()
Report progressvoid
void
run()
void
setBinaryStderr
(boolean binaryStderr) void
setBinaryStdout
(boolean binaryStdout) void
setCommandArgs
(String[] commandArgs) void
setObjetcToNotify
(Object objetcToNotify) void
void
setQuiet
(boolean quietStdout, boolean quietStderr) void
setRedirectStderr
(String redirectStderr) void
setRedirectStdout
(String redirectStdout) void
setSaveStd
(boolean saveStd) void
setShowExceptions
(boolean showExceptions) void
setStdoutAlert
(String alert) void
setStdoutAlertNotify
(Object toBeNotified) void
setStdOutFilter
(LineFilter stdOutFilter) toString()
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, yield
-
Field Details
-
debug
public static boolean debug
-
-
Constructor Details
-
ExecuteOsCommand
-
ExecuteOsCommand
-
-
Method Details
-
exec
public int exec() -
getCommandArgs
-
getExitValue
public int getExitValue() -
getHead
First lines of stdout -
getHeadStderr
First lines of stderr -
getProgress
public int getProgress()- Specified by:
getProgress
in interfaceProgress
-
getPwd
-
getRedirectStderr
-
getRedirectStdout
-
getStderr
-
getStdin
-
getStdout
-
getStdOutFilter
-
isAlertDone
public boolean isAlertDone() -
isBinaryStderr
public boolean isBinaryStderr() -
isBinaryStdout
public boolean isBinaryStdout() -
isExecuting
public boolean isExecuting() -
isQuiet
public boolean isQuiet() -
isSaveStd
public boolean isSaveStd() -
isStarted
public boolean isStarted() -
kill
public void kill() -
progress
public void progress()Report progress -
resetBuffers
public void resetBuffers() -
run
public void run() -
setBinaryStderr
public void setBinaryStderr(boolean binaryStderr) -
setBinaryStdout
public void setBinaryStdout(boolean binaryStdout) -
setCommandArgs
-
setObjetcToNotify
-
setPwd
-
setQuiet
public void setQuiet(boolean quietStdout, boolean quietStderr) -
setRedirectStderr
-
setRedirectStdout
-
setSaveStd
public void setSaveStd(boolean saveStd) -
setShowExceptions
public void setShowExceptions(boolean showExceptions) -
setStdoutAlert
-
setStdoutAlertNotify
-
setStdOutFilter
-
toString
-