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.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 TypeMethodDescriptionintexec()String[]intgetHead()First lines of stdoutFirst lines of stderrintgetPwd()getStdin()booleanbooleanbooleanbooleanbooleanisQuiet()booleanbooleanvoidkill()voidprogress()Report progressvoidvoidrun()voidsetBinaryStderr(boolean binaryStderr) voidsetBinaryStdout(boolean binaryStdout) voidsetCommandArgs(String[] commandArgs) voidsetObjetcToNotify(Object objetcToNotify) voidvoidsetQuiet(boolean quietStdout, boolean quietStderr) voidsetRedirectStderr(String redirectStderr) voidsetRedirectStdout(String redirectStdout) voidsetSaveStd(boolean saveStd) voidsetShowExceptions(boolean showExceptions) voidsetStdoutAlert(String alert) voidsetStdoutAlertNotify(Object toBeNotified) voidsetStdOutFilter(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, join, join, join, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, suspend, 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:
getProgressin 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
-