title: elasticsearch: convert StreamOutput to String
body: <p>I'm overriding <a href="https://static.javadoc.io/org.elasticsearch/elasticsearch/2.3.0/org/elasticsearch/client/FilterClient.html" rel="nofollow noreferrer"><code>FilterClient</code></a> so I can see incoming requests. I'd like some way to get a <code>String</code> representation of the <a href="https://static.javadoc.io/org.elasticsearch/elasticsearch/2.3.0/org/elasticsearch/action/ActionRequest.html" rel="nofollow noreferrer"><code>ActionRequest</code></a> that's passed in. <code>ActionRequest</code> let's you write to a <a href="https://static.javadoc.io/org.elasticsearch/elasticsearch/2.3.0/org/elasticsearch/common/io/stream/StreamOutput.html" rel="nofollow noreferrer"><code>StreamOuput</code></a>, which is an Elasticsearch type that is a subclass of <a href="http://docs.oracle.com/javase/7/docs/api/java/io/OutputStream.html?is-external=true" rel="nofollow noreferrer"><code>OutputStream</code></a>. This <a href="https://stackoverflow.com/questions/216894/get-an-outputstream-into-a-string">SO post</a> shows how to convert <code>OutputStream</code> to a String, but I'm forced to use <code>StreamOuput</code> due to the <code>FilterClient</code> API.</p>
  
  <p>How do I get a String representation of <code>ActionRequest</code> or at least a readable version that will show me useful information about the request? (Calling <code>ActionRequest.toString</code> calls <code>Object.toString</code>, which is not good enough for me.)</p>