title: Idiomatic way to convert an InputStream to a String in Scala
body: <p>I have a handy function that I've used in Java for converting an InputStream to a String.  Here is a direct translation to Scala:</p>
  
  <pre><code>  def inputStreamToString(is: InputStream) = {
      val rd: BufferedReader = new BufferedReader(new InputStreamReader(is, "UTF-8")) 
      val builder = new StringBuilder()    
      try {
        var line = rd.readLine 
        while (line != null) { 
          builder.append(line + "\n")
          line = rd.readLine
        }
      } finally {
        rd.close
      }
      builder.toString
    }
  </code></pre>
  
  <p>Is there an idiomatic way to do this in scala?</p>