title: connect OutputStream with an InputStream
body: <p>I'm experimenting with a little web framework and stumbled across an issue with streams. There are handler methods like <code>Response get(HttpServletRequest)</code>. From the frameworks perspective the response should offer an input stream for the response body. The framework reads this streams and writes the data to the underlying OutputStream of the Servlet API. But from the user's perspective an OutputStream is needed to write to.</p>
  
  <p>Framework's perspective:</p>
  
  <pre><code>public interface Response {
    InputStream getInputStream();
  }
  </code></pre>
  
  <p>User's perspective:</p>
  
  <pre><code>public interface Response {
    InputStream getOutputStream();
  }
  </code></pre>
  
  <p>It should be used like this:</p>
  
  <pre><code>public void get(HttpServletRequest request) {
    Response response = new Response(OK);
    response.getOutputStream().write(...);
    return response;
  }
  </code></pre>
  
  <p>The problem is that I cannot create an outputstream without an output target (and don't want to write to a ByteArray buffer).</p>
  
  <p>Any idea how to give the user an OutputStream without passing one in like in the Servlet API? I'd like to avoid output parameters.</p>