Package org.snpeff.osCmd
Class OsCmdRunner
- java.lang.Object
-
- java.lang.Thread
-
- org.snpeff.osCmd.OsCmdRunner
-
- All Implemented Interfaces:
java.lang.Runnable
public class OsCmdRunner extends java.lang.ThreadRun an OS command as a thread- Author:
- pcingola
-
-
Constructor Summary
Constructors Constructor Description OsCmdRunner(java.lang.String jobId, java.lang.String[] osCmdStr)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close (kill) commandvoidfinish()Stop execution of this threadlonggetDefaultWaitTime()java.lang.StringgetError()intgetExitValue()java.lang.StringgetHead()java.lang.StringgetHeadStderr()java.lang.StringgetJobId()ExecuteOsCommandgetOsCmd()intgetProgress()java.lang.StringgetStderr()java.lang.StringgetStdout()booleanisDone()Has this runner finished?booleanisExecuting()voidrun()static booleanrunIfNotExists(java.lang.String[] opts, java.lang.String outputFile, boolean redirectToOutput)Run an OS command only if the output files does not exists.booleanrunIfNotExists(java.lang.String outputFile, boolean redirectToOutput)Run a command only if 'outputFile' does not existvoidsetDefaultWaitTime(long defaultWaitTime)voidsetSaveStd(boolean save)java.lang.StringtoString()-
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
-
-
-
-
Method Detail
-
runIfNotExists
public static boolean runIfNotExists(java.lang.String[] opts, java.lang.String outputFile, boolean redirectToOutput)Run an OS command only if the output files does not exists. opts[0] : OS Command opts[1] ... opts[N] : Command line options outputFile : Where the results are stored (if the file exists, the command is NOT run) redirect : If 'redirect=true' then run "command > outputFile" (i.e. redirect STDOUT to 'outputFile'). Output is assumed to be binary.- Parameters:
opts-outputFile-redirectToOutput-- Returns:
- true if command executed OK or outputFile exists
-
close
public void close()
Close (kill) command
-
finish
public void finish()
Stop execution of this thread
-
getDefaultWaitTime
public long getDefaultWaitTime()
-
getError
public java.lang.String getError()
-
getExitValue
public int getExitValue()
-
getHead
public java.lang.String getHead()
-
getHeadStderr
public java.lang.String getHeadStderr()
-
getJobId
public java.lang.String getJobId()
-
getOsCmd
public ExecuteOsCommand getOsCmd()
-
getProgress
public int getProgress()
-
getStderr
public java.lang.String getStderr()
-
getStdout
public java.lang.String getStdout()
-
isDone
public boolean isDone()
Has this runner finished?- Returns:
-
isExecuting
public boolean isExecuting()
-
run
public void run()
- Specified by:
runin interfacejava.lang.Runnable- Overrides:
runin classjava.lang.Thread
-
runIfNotExists
public boolean runIfNotExists(java.lang.String outputFile, boolean redirectToOutput)Run a command only if 'outputFile' does not exist- Parameters:
outputFile-redirectToOutput-- Returns:
-
setDefaultWaitTime
public void setDefaultWaitTime(long defaultWaitTime)
-
setSaveStd
public void setSaveStd(boolean save)
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Thread
-
-