title: How do I convert an InputStream to a String in Java?
body: <p>Suppose I have an <code>InputStream</code> that contains text data, and I want to convert this to a <code>String</code> (for example, so I can write the contents of the stream to a log file).</p>
  
  <p>What is the easiest way to take the <code>InputStream</code> and convert it to a <code>String</code>?</p>
  
  <pre><code>public String convertStreamToString(InputStream is) { 
      // ???
  }
  </code></pre>