Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## UI.Run
Class GEVAStreamReader

    java.lang.Object
      java.lang.Thread
          UI.Run.GEVAStreamReader

All Implemented Interfaces:
  java.lang.Runnable

    public class GEVAStreamReader

extends java.lang.Thread

A class dedicated to reading the output and error streams of an external process (GEVA for example). This is done in a separate thread which the class handles

Author:
  eliott bartley

Nested Class Summary
`static class` | `GEVAStreamReader.Event` Event data for stream reading listeners
`static interface` | `GEVAStreamReader.Listener` Listen to stream reading events

Nested classes/interfaces inherited from class java.lang.Thread
`java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler`

Field Summary
`static int` | `ID_ERR_OUT` Write using error formatting
`static int` | `ID_STD_OUT` Write using output formatting

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`GEVAStreamReader(java.lang.ThreadGroup threadGroup, java.io.InputStream stream, int streamId)` Create a thread to read a stream and output to a string property

Method Summary
`void` | `addStreamListener(GEVAStreamReader.Listener streamListener)` Add a listener that can respond to new lines being read in from the stream.
`void` | `run()` Run the blocking stream reader in its own thread.

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

### ID_STD_OUT

    public static final int ID_STD_OUT

  Write using output formatting

  See Also:
    Constant Field Values

### ID_ERR_OUT

    public static final int ID_ERR_OUT

  Write using error formatting

  See Also:
    Constant Field Values

Constructor Detail

### GEVAStreamReader

    public GEVAStreamReader(java.lang.ThreadGroup threadGroup,
                            java.io.InputStream stream,
                            int streamId)

  Create a thread to read a stream and output to a string property

  Parameters:
    `stream` - The stream to read
    `streamId` - The streamId of stream this be, either ID_STD_OUT or ID_ERR_OUT

Method Detail

### run

    public void run()

  Run the blocking stream reader in its own thread. This thread can only be terminated by the stream coming to an end (process ended) or by killing the process whose stream is being read

  Specified by:
    `run` in interface `java.lang.Runnable`
  Overrides:
    `run` in class `java.lang.Thread`

### addStreamListener

    public void addStreamListener(GEVAStreamReader.Listener streamListener)

  Add a listener that can respond to new lines being read in from the stream. TODO (LISTENERS_TALK_TODO) the order in which listeners are added is important as listeners are free(ish) to modify the event listened to, and any listener that modifies the event will affect all listeners that were added after it was added. This is by design and allows the listeners to 'talk' to each other (hacky, but this system is the complete rewrite of what was a worse hack, and when the time is right, this hack will go too (maybe) but until then, this is an optimisation - i.e. when parsing, the things parsed by the graph-parser should not be parsed by the standard-parser, because it has the potential to cripple GEVA as it's too much data for the standard- parser's listeners to handle, but easily handled by the graph-parser's listeners, so it's important that the graph-parser can tell the standard-parser to ignore the lines it has parsed. I have not been able to think of a generic OO way to do this cleanly, so I wont even try. Update (2008y0M11d) ability for listeners to talk to each other has been restricted (they can no longer modify the line read from the stream) but has now been implemented through the use of 'extensions' of the stream parser's Line class, which acts as a proxy to this class's Event class. Note. this update does not change the requirement that the order of the listeners is important

  Parameters:
    `streamListener` - The object that can respond to new lines read from stream

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD