title: Android HttpResponse - Content has been consumed
body: <p>The method below falls over when reading the HttpResponse with the error: "Content has been  consumed". I understand that the content can only be consumed once but I get this error on the very first attempt and I don't see anywhere in the code where I'm possibly consuming it twice.</p>
  
  <pre><code>    private static String getData(String url, HttpParams params) {
      StringBuilder builder = new StringBuilder();
          HttpClient client = new DefaultHttpClient();
          HttpGet httpGet = new HttpGet(url);
          if (params != null) {
              httpGet.setParams(params);
          }
          String result = "";
          try {
              HttpResponse response = client.execute(httpGet);
              StatusLine statusLine = response.getStatusLine();
              int statusCode = statusLine.getStatusCode();
              if (statusCode == 200) {
                  HttpEntity entity = response.getEntity();
                  InputStream content = entity.getContent();
                  BufferedReader reader = new BufferedReader(new InputStreamReader(content));
                  String line;
                  while ((line = reader.readLine()) != null) {
                      builder.append(line);
                  }
                  content.close();
                  result = builder.toString();
              } 
          } catch (ClientProtocolException e) {
              e.printStackTrace();
          } catch (IOException e) {
              e.printStackTrace();
          } catch (Exception e) {
              e.printStackTrace();
          }
      return result;  
      }
  </code></pre>