Java: Writing to the real STDOUT after System.setOut
<p>I'm trying to intercept System.out and System.err, but maintain the ability to write to the original streams directly when necessary.</p>

<pre><code>PrintStream ps = System.out;
System.setOut(new MyMagicPrintStream());
ps.println("foo");
</code></pre>

<p>Unfortunately, the details of the System class' implementation means that in my example, "foo" gets sent to MyMagicPrintStream instread of the real stdout.  Does anyone know how to get references to the real/original OutputStreams.</p>

<p>Thanks!</p>

<p>PS: This will otherwise result in a StackOverflowError &lt;-- for SEO.</p>
