title: Convert a StreamWriter to an OutputStream in java?
body: <p>I am trying to redirect System.out into a String using System.setOut, which takes a PrintStream. Is there any way to convert a StringWriter into a Stream so that I can pass it to setOut?</p>