Class AbstractProcessReader
- java.lang.Object
-
- com.github.fracpete.processoutput4j.core.AbstractProcessRunnable
-
- com.github.fracpete.processoutput4j.reader.AbstractProcessReader
-
- All Implemented Interfaces:
java.lang.Runnable
- Direct Known Subclasses:
CollectingProcessReader,ConsoleOutputProcessReader,StreamingProcessReader
public abstract class AbstractProcessReader extends AbstractProcessRunnable
Ancestor for readers that read line from stdout/stderr of the providedProcessobject.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
-
-
Field Summary
Fields Modifier and Type Field Description protected java.io.BufferedReaderm_Readerthe reader use internally.protected booleanm_Stdoutwhether to use stdout or stderr.-
Fields inherited from class com.github.fracpete.processoutput4j.core.AbstractProcessRunnable
m_Process, m_Queue, m_Stopped
-
-
Constructor Summary
Constructors Constructor Description AbstractProcessReader(boolean stdout)Initializes the reader.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voiddoRun()The actual processing loop.voidflush()Flushes the data.booleanisStdout()Returns whether the reader is for stdout or stderr.protected abstract voidprocess(java.lang.String line)For processing the line read from stdout/stderr.-
Methods inherited from class com.github.fracpete.processoutput4j.core.AbstractProcessRunnable
getProcess, isStopped, logError, logError, run, setProcess, stopExecution
-
-
-
-
Method Detail
-
isStdout
public boolean isStdout()
Returns whether the reader is for stdout or stderr.- Returns:
- true if for stdout
-
process
protected abstract void process(java.lang.String line)
For processing the line read from stdout/stderr.- Parameters:
line- the output line
-
flush
public void flush()
Flushes the data.
-
doRun
protected void doRun()
The actual processing loop.- Specified by:
doRunin classAbstractProcessRunnable
-
-