|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
console.StreamTask
console.SimpleOutputStreamTask
public class SimpleOutputStreamTask
SimpleOutputStreamTask is a base outputting class. It gets a data from an external InputStream and dumps one to an external Output using a defaultColor. Main working method run() of this class is marked as final. On the other hand SimpleOutputStreamTask provides its descendants with a few methods, which descendants can override. Below these methods are shown inside the run() method's body run() { try { beforeWorking() try { MAIN-LOOP { try { WAITING-LOOP { // reading from InputStream isr // sleep actionInsideWaitingLoop(isr) } } catch (InterruptedException ie) { break // MAIN-LOOP } // lineBuffer's filling outputData() } } finally { finalOutputting() afterWorking() } } catch (Exception e) { exception_dumpToLog(e) exception_dumpToOwner(e) } }
Nested Class Summary | |
---|---|
static class |
SimpleOutputStreamTask.WLTypes
Types of waiting loop. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected int |
BufferSize
|
protected java.awt.Color |
defaultColor
|
protected java.io.InputStream |
in
|
protected java.lang.StringBuilder |
lineBuffer
|
protected Output |
output
|
protected int |
SleepDelayMSec
|
Fields inherited from class console.StreamTask |
---|
abortFlag, finishFlag |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
SimpleOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor)
|
Method Summary | |
---|---|
protected void |
actionInsideWaitingLoop(java.io.InputStreamReader isr)
Run waiting loop inside. |
protected void |
afterWorking()
Run AFTER: - main working loop ends - "finalOutputing()" method (under "try" section) |
protected void |
beforeWorking()
Run BEFORE main working loop starts (under "try" section) |
protected void |
exception_dumpToLog(java.lang.Exception e)
By default dump data about exception to jEdit.Log BEFORE "exception_dumpToOwner()" method (under "catch" section) |
protected void |
exception_dumpToOwner(java.lang.Exception e)
By default do nothing AFTER "exception_dumpToLog" method (under "catch" section) |
protected void |
finalOutputting()
Dump remained data from internal buffer "lineBuffer" to output "output" with color "defaultColor". |
protected void |
outputData()
- Dump collected data from internal buffer "lineBuffer" to output "output" with color "defaultColor" - Clean internal buffer "lineBuffer" (under "try" section) |
void |
run()
|
void |
setWaitingLoop(SimpleOutputStreamTask.WLTypes wl)
Setup waiting loop. |
Methods inherited from class console.StreamTask |
---|
abort, finish |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected int BufferSize
protected int SleepDelayMSec
protected java.io.InputStream in
protected java.awt.Color defaultColor
protected Output output
protected java.lang.StringBuilder lineBuffer
Constructor Detail |
---|
public SimpleOutputStreamTask(java.io.InputStream in, Output output, java.awt.Color defaultColor)
Method Detail |
---|
protected void actionInsideWaitingLoop(java.io.InputStreamReader isr) throws java.lang.Exception
java.lang.Exception
protected void afterWorking() throws java.lang.Exception
java.lang.Exception
protected void beforeWorking() throws java.lang.Exception
java.lang.Exception
protected void finalOutputting()
protected void exception_dumpToLog(java.lang.Exception e)
protected void exception_dumpToOwner(java.lang.Exception e)
public final void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected void outputData() throws java.lang.Exception
java.lang.Exception
public void setWaitingLoop(SimpleOutputStreamTask.WLTypes wl)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |