Package com.jalios.io

Class StreamGobbler

  • All Implemented Interfaces:
    java.lang.Runnable

    public class StreamGobbler
    extends java.lang.Object
    implements java.lang.Runnable
    Class required for process execution to prevent process hang if out/err of program is not read in a seperated thread. http://www.velocityreviews.com/forums/t130884-process-runtimeexec-causes-subprocess-hang.html
    Since:
    jcms-6.1.2
    • Constructor Summary

      Constructors 
      Constructor Description
      StreamGobbler​(java.lang.String name, java.io.InputStream in)
      Constructs a new StreamGobbler.
      StreamGobbler​(java.lang.String name, java.io.InputStream in, java.io.OutputStream out)
      Constructs a new StreamGobbler which dump the input stream in an OuputStream.
      StreamGobbler​(java.lang.String name, java.io.InputStream in, java.lang.StringBuilder sb)
      Constructs a new StreamGobbler which dump the input stream to a StringBuilder
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String getString()  
      void run()  
      void start()  
      • Methods inherited from class java.lang.Object

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

      • StreamGobbler

        public StreamGobbler​(java.lang.String name,
                             java.io.InputStream in)
        Constructs a new StreamGobbler.
        Parameters:
        name - the name (for the thread)
        in - the input stream
      • StreamGobbler

        public StreamGobbler​(java.lang.String name,
                             java.io.InputStream in,
                             java.lang.StringBuilder sb)
        Constructs a new StreamGobbler which dump the input stream to a StringBuilder
        Parameters:
        name - the name (for the thread)
        in - the input stream
        sb - the StringBuilder
      • StreamGobbler

        public StreamGobbler​(java.lang.String name,
                             java.io.InputStream in,
                             java.io.OutputStream out)
        Constructs a new StreamGobbler which dump the input stream in an OuputStream.
        Parameters:
        name - the name (for the thread)
        in - the input stream
        out - the OutputStream
    • Method Detail

      • start

        public void start()
      • run

        public void run()
        Specified by:
        run in interface java.lang.Runnable
      • getString

        public java.lang.String getString()