Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.StreamPumper


    /**
     * Creates a stream pumper to copy the given input stream to the given output stream.
     */
    protected Thread createPump(InputStream is, OutputStream os) {
        final Thread result = new Thread(new StreamPumper(is, os));
        result.setDaemon(true);
        return result;
    }
View Full Code Here


                // Create the stream pumpers to forward listcab's stdout and stderr to the log
                // note: listcab is an interactive program, and issues prompts for every new line.
                //       Therefore, make it show only with verbose logging turned on.
                LogOutputStream outLog = new LogOutputStream(this, Project.MSG_VERBOSE);
                LogOutputStream errLog = new LogOutputStream(this, Project.MSG_ERR);
                StreamPumper    outPump = new StreamPumper(p.getInputStream(), outLog);
                StreamPumper    errPump = new StreamPumper(p.getErrorStream(), errLog);

                // Pump streams asynchronously
                (new Thread(outPump)).start();
                (new Thread(errPump)).start();

                int result = -99; // A wild default for when the thread is interrupted

                try {
                    // Wait for the process to finish
                    result = p.waitFor();

                    // Wait for the end of output and error streams
                    outPump.waitFor();
                    outLog.close();
                    errPump.waitFor();
                    errLog.close();
                } catch (InterruptedException ie) {
                    log("Thread interrupted: " + ie);
                }
View Full Code Here

          // Don't do anything.
          break;
      }
      eventBus.post(bootstrap);

      pumpers.add(new Thread(new StreamPumper(stderr, stderrBuffered), "pumper-stderr"));
      pumpers.add(new Thread(new Runnable() {
        public void run() {
          pumpEvents();
        }
      }, "pumper-events"));
    } catch (IOException e) {
      warnStream.println("Couldn't establish event communication with the slave: " + e.toString());
      if (!(e instanceof EOFException)) {
        e.printStackTrace(warnStream);
      }
      pumpers.add(new Thread(new StreamPumper(stderr, stderrBuffered), "pumper-stderr"));
    }
   
    // Start all pumper threads.
    UncaughtExceptionHandler handler = new UncaughtExceptionHandler() {
      public void uncaughtException(Thread t, Throwable e) {
View Full Code Here

    /**
     * Creates a stream pumper to copy the given input stream to the given output stream.
     */
    protected Thread createPump(InputStream is, OutputStream os) {
        final Thread result = new Thread(new StreamPumper(is, os));
        result.setDaemon(true);
        return result;
    }
View Full Code Here

                // Create the stream pumpers to forward listcab's stdout and stderr to the log
                // note: listcab is an interactive program, and issues prompts for every new line.
                //       Therefore, make it show only with verbose logging turned on.
                LogOutputStream outLog = new LogOutputStream(this, Project.MSG_VERBOSE);
                LogOutputStream errLog = new LogOutputStream(this, Project.MSG_ERR);
                StreamPumper    outPump = new StreamPumper(p.getInputStream(), outLog);
                StreamPumper    errPump = new StreamPumper(p.getErrorStream(), errLog);

                // Pump streams asynchronously
                (new Thread(outPump)).start();
                (new Thread(errPump)).start();

                out.write(sb.toString().getBytes());
                out.flush();
                out.close();

                int result = -99; // A wild default for when the thread is interrupted

                try {
                    // Wait for the process to finish
                    result = p.waitFor();

                    // Wait for the end of output and error streams
                    outPump.waitFor();
                    outLog.close();
                    errPump.waitFor();
                    errLog.close();
                } catch (InterruptedException ie) {
                    log("Thread interrupted: " + ie);
                }
View Full Code Here

        os, Charset.defaultCharset());
  }
 
  @Override
  public void start() throws IOException {
    pumpers.add(new Thread(new StreamPumper(stdout, sysout), "pumper-stdout"));
    pumpers.add(new Thread(new StreamPumper(stderr, syserr), "pumper-stderr"));
    pumpers.add(new Thread(new Runnable() {
      public void run() {
        pumpEvents(eventStream);
      }
    }, "pumper-events"));
View Full Code Here

          // Don't do anything.
          break;
      }
      eventBus.post(bootstrap);

      pumpers.add(new Thread(new StreamPumper(stderr, stderrBuffered), "pumper-stderr"));
      pumpers.add(new Thread(new Runnable() {
        public void run() {
          pumpEvents();
        }
      }, "pumper-events"));
    } catch (IOException e) {
      warnStream.println("Couldn't establish event communication with the slave: " + e.toString());
      if (!(e instanceof EOFException)) {
        e.printStackTrace(warnStream);
      }
      pumpers.add(new Thread(new StreamPumper(stderr, stderrBuffered), "pumper-stderr"));
    }
   
    // Start all pumper threads.
    UncaughtExceptionHandler handler = new UncaughtExceptionHandler() {
      public void uncaughtException(Thread t, Throwable e) {
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.StreamPumper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.