/** creates a capturing context which sees the output to this stream, without interrupting the original target */ public OutputCapturingContext captureTee() { ByteArrayOutputStream out = new ByteArrayOutputStream(); PrintStream toRestore = setThreadLocalPrintStream(new TeeOutputStream(getDelegate(), out)); return new OutputCapturingContext(this, out, toRestore); }
/** creates a capturing context which eats the output to this stream, blocking the original target */ public OutputCapturingContext capture() { return new OutputCapturingContext(this); }