title: Alternative to IOUtils.toString() for large streams?
body: <p>I'm getting a large response stream back from an HTTP request.  It's JSON, so I need to convert it to a string for processing.  I'm running out of heap space on the call to toString.</p>
  
  <p>Code is as follows:</p>
  
  <pre><code>URLConnection conn = new URL(url + "?query=" + URLEncoder.encode(sparql, "UTF-8") + "&amp;output=JSON").openConnection();
  conn.setRequestProperty("Accept-Charset", "UTF-8");
  InputStream respStream = conn.getInputStream();
  response = IOUtils.toString(respStream, "UTF-8");
  respStream.close();
  </code></pre>
  
  <p>I've tried setting the heap size as large as I can. I can't get the data in smaller chunks easily (but if there's not a better choice, I'll implement that).  Any suggestions?</p>