protected WrappedOutputStream(OutputStream delegate) { setDelegate(delegate); }
private static void redirectSystemOuts() { originalSystemOut = System.out; originalSystemErr = System.err; wrappedSystemOut = new WrappedOutputStream(originalSystemOut); wrappedSystemErr = new WrappedOutputStream(originalSystemErr); System.setOut(new PrintStream(wrappedSystemOut)); System.setErr(new PrintStream(wrappedSystemErr)); }
public static PrintStream getOriginalSystemErr() { redirectOnDemand(); return new PrintStream(new WrappedOutputStream(originalSystemErr), true); }
private static void resetSystemOuts() { if (originalSystemOut == null || originalSystemErr == null) { return; } System.setOut(originalSystemOut); System.setErr(originalSystemErr); wrappedSystemOut.setDelegate(originalSystemOut); wrappedSystemOut = null; wrappedSystemErr.setDelegate(originalSystemErr); wrappedSystemErr = null; }
public static PrintStream getOriginalSystemOut() { redirectOnDemand(); return new PrintStream(new WrappedOutputStream(originalSystemOut), true); }
/** * Redirects the system output stream to the specified target. * * @param newTarget * The new target stream. */ public static void redirectSystemOut(OutputStream newTarget) { if (wrappedSystemOut == null) { throw new IllegalStateException("The engine was not bootstrapped."); } else { wrappedSystemOut.setDelegate(newTarget); } }
/** * Redirects the system error stream to the specified target. * * @param newTarget * The new target stream. */ public static void redirectSystemError(OutputStream newTarget) { if (wrappedSystemErr == null) { throw new IllegalStateException("The engine was not bootstrapped."); } else { wrappedSystemErr.setDelegate(newTarget); } }