/** * @return PrintStream * @since Ant 1.8.0 */ private static PrintStream wrap(PrintStream ps) { return new PrintStream(new KeepAliveOutputStream(ps)); } }
/** * Convenience factory method that returns a non-closing * PrintStream around System.out. * * @return PrintStream * @since Ant 1.8.0 */ public static PrintStream wrapSystemOut() { return wrap(System.out); }
PrintStream out = KeepAliveOutputStream.wrapSystemOut(); try { if (output != null) {
final ByteArrayOutputStream out = new ByteArrayOutputStream(); final ByteArrayOutputStream errout = new ByteArrayOutputStream(); final OutputStream teeErr = suppressSystemErr ? errout : new TeeOutputStream(errout, KeepAliveOutputStream.wrapSystemErr()); final OutputStream tee = suppressSystemOut ? out : new TeeOutputStream(out, KeepAliveOutputStream.wrapSystemOut());
/** outStreams */ private void outStreams() { if (out != null && out.length > 0) { final String logHead = "Output " + ((appendOut) ? "appended" : "redirected") + " to "; outputStream = foldFiles(out, logHead, Project.MSG_VERBOSE, appendOut, createEmptyFilesOut); } if (outputProperty != null) { if (baos == null) { baos = new PropertyOutputStream(outputProperty); managingTask.log("Output redirected to property: " + outputProperty, Project.MSG_VERBOSE); } // shield it from being closed by a filtering StreamPumper final OutputStream keepAliveOutput = new KeepAliveOutputStream(baos); outputStream = (outputStream == null) ? keepAliveOutput : new TeeOutputStream(outputStream, keepAliveOutput); } else { baos = null; } }
/** * Convenience factory method that returns a non-closing * PrintStream around System.err. * * @return PrintStream * @since Ant 1.8.0 */ public static PrintStream wrapSystemErr() { return wrap(System.err); }
final OutputStream keepAliveError = new KeepAliveOutputStream(errorBaos); errorStream = (error == null || error.length == 0) ? keepAliveError : new TeeOutputStream(errorStream, keepAliveError);
/** * Set output stream for formatter to use. * * <p>Defaults to standard out.</p> * @param out the output stream to use. */ public void setOutput(OutputStream out) { if (out == System.out || out == System.err) { out = new KeepAliveOutputStream(out); } this.out = out; }
tee = new TeeOutputStream(teeout, new KeepAliveOutputStream(System.out)); }else{ tee= new KeepAliveOutputStream(System.out); channel.setExtOutputStream(new KeepAliveOutputStream(System.err), true); if (istream != null) { channel.setInputStream(istream);