Package org.apache.commons.io.output

Examples of org.apache.commons.io.output.TeeOutputStream


                        if (local.length()>0){
                            output=new FileOutputStream(local);
                            if (target==null) {
                                target=output;
                            } else {
                                target = new TeeOutputStream(output,baos);
                            }
                        }
                        if (target == null){
                            target=new NullOutputStream();
                        }
View Full Code Here


    // capture sysout/ syserr.
    sw = new StringWriter();
    sysout = System.out;
    syserr = System.err;
    System.setOut(new PrintStream(new TeeOutputStream(System.out, new WriterOutputStream(sw))));
    System.setErr(new PrintStream(new TeeOutputStream(System.err, new WriterOutputStream(sw))));
   
    // Add custom logging handler because java logging keeps a reference to previous System.err.
    loggingMessages = new StringWriter();
    logger = Logger.getLogger("");
    handlers = logger.getHandlers();
View Full Code Here

                  if (local.length()>0){
                    output=new FileOutputStream(local);
                    if (target==null) {
                      target=output;
                    } else {
                      target = new TeeOutputStream(output,baos);
                    }
                  }
                  if (target == null){
                    target=new NullOutputStream();
                  }
View Full Code Here

            new BufferedOutputStream(
                new FileOutputStream(
                    new File(getHeritrixHome(), STARTLOG)),16384);
        PrintStream startupOut =
            new PrintStream(
                new TeeOutputStream(
                    System.out,
                    startupOutStream));

        CommandLine cl = getCommandLine(startupOut, args);
        if (cl == null) return;
View Full Code Here

  private static PumpStreamHandler redirectOutputAlsoTo(PumpStreamHandler pumps, OutputStream output) {
    if (output == null)
      throw new IllegalArgumentException("OutputStream must be provided.");
    OutputStream current = pumps.getOut();
    if (current != null && !(current instanceof NullOutputStream)) {
      output = new TeeOutputStream(current, output);
    }
    return new PumpStreamHandler(output, pumps.getErr(), pumps.getInput());
  }
View Full Code Here

  private static PumpStreamHandler redirectErrorAlsoTo(PumpStreamHandler pumps, OutputStream output) {
    if (output == null)
      throw new IllegalArgumentException("OutputStream must be provided.");
    OutputStream current = pumps.getErr();
    if (current != null && !(current instanceof NullOutputStream)) {
      output = new TeeOutputStream(current, output);
    }
    return new PumpStreamHandler(pumps.getOut(), output, pumps.getInput());
  }
View Full Code Here

    public void aroundWriteTo(ProceedingJoinPoint proceedingJoinPoint,
            MessageContext msgContext, OMOutputFormat format, OutputStream out, boolean preserve)
            throws Throwable {
        OutputStream log = LogManager.INSTANCE.createLog("formatter");
        try {
            OutputStream tee = new TeeOutputStream(out, log);
            proceedingJoinPoint.proceed(new Object[] { msgContext, format, tee, preserve });
        } finally {
            log.close();
        }
    }
View Full Code Here

          warnings = System.err;
          throw new RuntimeException("Communication not implemented: " + channel);
      }

      if (sinkLog != null) {
        sink = new TeeOutputStream(sink, new FileOutputStream(sinkLog));
      }

      serializer = new Serializer(new BufferedOutputStream(sink, bufferSize));

      // Redirect original streams and start running tests.
View Full Code Here

        if (execHandle != null) {
            throw new IllegalStateException("you have already called start() on this handle");
        }

        AbstractExecHandleBuilder execBuilder = execHandleFactory.create();
        execBuilder.setStandardOutput(new CloseShieldOutputStream(new TeeOutputStream(System.out, standardOutput)));
        execBuilder.setErrorOutput(new CloseShieldOutputStream(new TeeOutputStream(System.err, errorOutput)));
        execHandle = execBuilder.build();

        execHandle.start();

        return this;
View Full Code Here

        OutputStream out = serialOutput;
        if (compress) {
            out = new LZFOutputStream(serialOutput);
        }
        if (DEBUG) {
            out = new TeeOutputStream(out, System.out);
        }
        try {
            xstreamPersister.save(info, out);
            out.flush();
            out.close();
View Full Code Here

TOP

Related Classes of org.apache.commons.io.output.TeeOutputStream

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.