title: Output stream over a StringBuilder
body: <p>I think this has been answered but I can't seem to find it.</p>
  
  <p>I have an instance method which writes some contents to an output stream</p>
  
  <pre><code>writeTo(OutputStream){
       //class specific logic
  }
  </code></pre>
  
  <p>I want it to get these contents into a StringBuilder. I can do this via a temporary file but that does not seem right. I want to do something like:</p>
  
  <pre><code>Stringbuilder sb = /* */;
  OutputStream os = outForStringBuilder(sb);//not sure how to do this
  instance.writeTo(os); //This should write the contents to Stringbuilder
  </code></pre>