Package org.snpeff.osCmd
Class StreamGobbler
- java.lang.Object
-
- java.lang.Thread
-
- org.snpeff.osCmd.StreamGobbler
-
- All Implemented Interfaces:
java.lang.Runnable
public class StreamGobbler extends java.lang.Thread
Read the contents of a stream in a separate thread This class is used when executing OS commands in order to read STDOUT / STDERR and prevent process blocking It can alert an AlertListener when a given string is in the stream- Author:
- pcingola
-
-
Field Summary
Fields Modifier and Type Field Description static int
BUFFER_SIZE
static int
HEAD_SIZE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
getAlert()
java.lang.Object
getAlertNotify()
java.lang.String
getAllLines()
java.lang.String
getHead()
Head: First HEAD_SIZE lines of this outputjava.lang.String
getRedirectTo()
boolean
isAlertDone()
boolean
isBinary()
boolean
isRunning()
void
resetBuffer()
void
run()
void
setAlert(java.lang.String alert)
void
setAlertNotify(java.lang.Object alertNotify)
void
setBinary(boolean binary)
void
setLineFilter(LineFilter lineFilter)
void
setProgress(Progress progress)
void
setQuietMode()
void
setRedirectTo(java.lang.String redirectTo)
void
setSaveLinesInMemory(boolean saveLinesInMemory)
-
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, toString, yield
-
-
-
-
Method Detail
-
getAlert
public java.lang.String getAlert()
-
getAlertNotify
public java.lang.Object getAlertNotify()
-
getAllLines
public java.lang.String getAllLines()
-
getHead
public java.lang.String getHead()
Head: First HEAD_SIZE lines of this output- Returns:
-
getRedirectTo
public java.lang.String getRedirectTo()
-
isAlertDone
public boolean isAlertDone()
-
isBinary
public boolean isBinary()
-
isRunning
public boolean isRunning()
-
resetBuffer
public void resetBuffer()
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
- Overrides:
run
in classjava.lang.Thread
-
setAlert
public void setAlert(java.lang.String alert)
-
setAlertNotify
public void setAlertNotify(java.lang.Object alertNotify)
-
setBinary
public void setBinary(boolean binary)
-
setLineFilter
public void setLineFilter(LineFilter lineFilter)
-
setProgress
public void setProgress(Progress progress)
-
setQuietMode
public void setQuietMode()
-
setRedirectTo
public void setRedirectTo(java.lang.String redirectTo)
-
setSaveLinesInMemory
public void setSaveLinesInMemory(boolean saveLinesInMemory)
-
-