Class StreamGobbler

  • All Implemented Interfaces:
    java.lang.Runnable

    public class StreamGobbler
    extends java.lang.Thread
    Implements a stream Gobbler that emits to the instantiator tracer. This is a helpful class if output/error streams of system processes shall be emitted to the EASy instantiation console.
    Author:
    Holger Eichelberger
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  StreamGobbler.IMsgManipulator
      Allows to manipulate messages.
      • Nested classes/interfaces inherited from class java.lang.Thread

        java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
    • Constructor Summary

      Constructors 
      Constructor Description
      StreamGobbler​(java.io.InputStream is, boolean isErrorStream)
      Creates a stream gobbler.
      StreamGobbler​(java.io.InputStream is, boolean isErrorStream, StreamGobbler.IMsgManipulator manipulator)
      Creates a stream gobbler.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static void gobble​(java.lang.Process proc)
      Creates standard gobblers for the given process.
      static void gobble​(java.lang.Process proc, StreamGobbler.IMsgManipulator manipulator)
      Creates standard gobblers for the given process.
      void run()  
      • 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
      • Methods inherited from class java.lang.Object

        equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • StreamGobbler

        public StreamGobbler​(java.io.InputStream is,
                             boolean isErrorStream)
        Creates a stream gobbler.
        Parameters:
        is - the input stream to be gobbled and emitted
        isErrorStream - whether is is an error or an input stream
      • StreamGobbler

        public StreamGobbler​(java.io.InputStream is,
                             boolean isErrorStream,
                             StreamGobbler.IMsgManipulator manipulator)
        Creates a stream gobbler.
        Parameters:
        is - the input stream to be gobbled and emitted
        isErrorStream - whether is is an error or an input stream
        manipulator - an optional message manipulator
    • Method Detail

      • gobble

        public static void gobble​(java.lang.Process proc)
        Creates standard gobblers for the given process.
        Parameters:
        proc - the process to gobble
      • gobble

        public static void gobble​(java.lang.Process proc,
                                  StreamGobbler.IMsgManipulator manipulator)
        Creates standard gobblers for the given process.
        Parameters:
        proc - the process to gobble
        manipulator - an optional message manipulator
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
        Overrides:
        run in class java.lang.Thread