|
|||||||||
| 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
console.ParsingOutputStreamTask
public class ParsingOutputStreamTask
ParsingOutputStreamTask is an outputting thread using an error parrser and an ANSI escaped sequencies parser. User can set parsers either at the moment of class's creating or after class' creation. If some parser is not defined - the class does not use that parser. A char's sequence from an InputStream (size == SimpleOutputStreamTask.BufferSize) is divided by line's breaks (if any), because the error parser might work with individual lines only, not the whole sequence - in common case InputStream can produce really many individual lines. On the other hand, each individual line is output in EDT (AWT-EventQueue). So, if InputStream produces a lot of lines - most of the time EDT processes them, and not other events of the jEdit's interface: it will hang until all the generated lines will be processed. However, this can be avoided if the output are not the individual lines, but an array of them. In this case, the number of events that must be processed EDT, sharply reduced. For this reason after processing of each individual line ParsingOutputStreamTask tries flush one to the cache. If the cache is full (CACHE_SIZE_LIMIT) or current style attributes are changed then the whole cache is flushed to output.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class console.SimpleOutputStreamTask |
|---|
SimpleOutputStreamTask.WLTypes |
| Nested classes/interfaces inherited from class java.lang.Thread |
|---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Field Summary |
|---|
| Fields inherited from class console.SimpleOutputStreamTask |
|---|
BufferSize, defaultColor, in, lineBuffer, output, SleepDelayMSec |
| Fields inherited from class console.StreamTask |
|---|
abortFlag, finishFlag |
| Fields inherited from class java.lang.Thread |
|---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| Constructor Summary | |
|---|---|
ParsingOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor,
java.awt.Color backgroundColor,
CommandOutputParser extErrorParser,
AnsiEscapeParser extAnsiParser)
Create instance using external parsers. |
|
ParsingOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor,
java.awt.Color backgroundColor,
org.gjt.sp.jedit.View view,
errorlist.DefaultErrorSource des,
java.lang.String currentDirectory)
Create instance using given View and DefaultErrorSource. |
|
ParsingOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor,
Console console,
java.lang.String currentDirectory)
Create instance using default Console's parameters. |
|
| Method Summary | |
|---|---|
protected void |
actionInsideWaitingLoop(java.io.InputStreamReader isr)
Extended outputting: working process outputs nothing a long time. |
protected void |
afterWorking()
Run AFTER: - main working loop ends - "finalOutputing()" method (under "try" section) |
protected void |
finalOutputting()
Dump remained data from internal buffer "lineBuffer" to output "output" with color "defaultColor". |
protected void |
outputData()
Do followed: - exchanging and removing symbols in whole input line - splitting input line by line breaks |
boolean |
pop(boolean forced)
Pop the cached data from the outputting cache to Output. |
void |
push(javax.swing.text.SimpleAttributeSet currentAttrs,
java.lang.String str)
Push a string to the outputting cache with a some AttributeSet. |
void |
setAnsiParser(AnsiEscapeParser extAnsiParser)
Set given ansi parser. |
void |
setAnsiParser(java.awt.Color defaultColor,
java.awt.Color backgroundColor)
Create new ansi parser and set one. |
void |
setErrorParser(CommandOutputParser extErrorParser)
Set given error parser.. |
void |
setErrorParser(org.gjt.sp.jedit.View view,
errorlist.DefaultErrorSource des,
java.awt.Color defaultColor,
java.lang.String currentDirectory)
Create new error parser and set one. |
java.lang.String |
trim_cache()
Remove a noncached data (placed AFTER the cache) from the cache. |
| Methods inherited from class console.SimpleOutputStreamTask |
|---|
beforeWorking, exception_dumpToLog, exception_dumpToOwner, run, setWaitingLoop |
| 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 |
| Constructor Detail |
|---|
public ParsingOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor,
java.awt.Color backgroundColor,
org.gjt.sp.jedit.View view,
errorlist.DefaultErrorSource des,
java.lang.String currentDirectory)
in - input stream, from which we receive dataoutput - instance implements OutputdefaultColor - default foreground colorbackgroundColor - default backgroundColor colorview - working jEdit's viewdes - error source for error parsercurrentDirectory - console's current (working) directory
public ParsingOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor,
Console console,
java.lang.String currentDirectory)
in - input stream, from which we receive dataoutput - instance implements OutputdefaultColor - default foreground colorconsole - console, which manipulates the input streamcurrentDirectory - console's current (working) directory
public ParsingOutputStreamTask(java.io.InputStream in,
Output output,
java.awt.Color defaultColor,
java.awt.Color backgroundColor,
CommandOutputParser extErrorParser,
AnsiEscapeParser extAnsiParser)
in - input stream, from which we receive dataoutput - instance implements OutputdefaultColor - default foreground colorbackgroundColor - default backgroundColor colorextErrorParser - given error parser instanceextAnsiParser - given ansi parser instance| Method Detail |
|---|
public void push(javax.swing.text.SimpleAttributeSet currentAttrs,
java.lang.String str)
currentAttrs - current value of the AttributeSetstr - outputed stringpublic boolean pop(boolean forced)
forced - if "true" the cache is flushed by force
public java.lang.String trim_cache()
protected void actionInsideWaitingLoop(java.io.InputStreamReader isr)
throws java.lang.Exception
actionInsideWaitingLoop in class SimpleOutputStreamTaskjava.lang.Exception
protected void afterWorking()
throws java.lang.Exception
SimpleOutputStreamTask
afterWorking in class SimpleOutputStreamTaskjava.lang.Exceptionprotected void finalOutputting()
SimpleOutputStreamTask
finalOutputting in class SimpleOutputStreamTask
protected void outputData()
throws java.lang.Exception
outputData in class SimpleOutputStreamTaskjava.lang.Exceptionpublic void setAnsiParser(AnsiEscapeParser extAnsiParser)
extAnsiParser - given ansi parser instance
public void setAnsiParser(java.awt.Color defaultColor,
java.awt.Color backgroundColor)
defaultColor - default foreground colorbackgroundColor - default backgroundColor colorpublic void setErrorParser(CommandOutputParser extErrorParser)
extErrorParser - given error parser instance
public void setErrorParser(org.gjt.sp.jedit.View view,
errorlist.DefaultErrorSource des,
java.awt.Color defaultColor,
java.lang.String currentDirectory)
view - working jEdit's viewdes - error source for error parserdefaultColor - default foreground colorcurrentDirectory - console's current (working) directory
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||