Class ConsoleConsumer

  • All Implemented Interfaces:
    Runnable

    @Deprecated(forRemoval=true)
    public class ConsoleConsumer
    extends Object
    implements Runnable
    Deprecated, for removal: This API element is subject to removal in a future version.
    moved to new https://github.com/wildfly/wildfly-plugin-tools project
    A utility which will consume output from an InputStream and write it to an OutputStream. This is commonly used when a processes stdout or stderr needs to be consumed and redirected somewhere.
    Author:
    James R. Perkins
    • Constructor Detail

      • ConsoleConsumer

        public ConsoleConsumer​(InputStream in,
                               OutputStream out)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates a new console consumer which will pipe the InputStream to the OutputStream.
        Parameters:
        in - the input stream that should be pipped
        out - the output stream where the data should be written
    • Method Detail

      • start

        public static Thread start​(Process process,
                                   OutputStream out)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates and starts a daemon thread which consumes a processes stdout stream and pipes the date to the output stream.

        Note that when using this method the ProcessBuilder.redirectErrorStream(boolean) should likely be true. Otherwise another thread should be created to consume stderr.

        Parameters:
        process - the process
        out - the output stream where the data should be written
        Returns:
        the thread that was started
      • start

        public static Thread start​(InputStream in,
                                   OutputStream out)
        Deprecated, for removal: This API element is subject to removal in a future version.
        Creates and starts a daemon thread which pipes int InputStream to the OutputStream.
        Parameters:
        in - the input stream that should be pipped
        out - the output stream where the data should be written
        Returns:
        the thread that was started
      • run

        public void run()
        Deprecated, for removal: This API element is subject to removal in a future version.
        Specified by:
        run in interface Runnable