title: Incomplete content (buffer) of webpage
body: <p>I want to read the content of a webpage with the following methods, but I only get 60-70 percent of it.</p>
  
  <p>I've tried 2 different methods to read the webpage, both with the same result. I also tried different Urls. I get no errors or timeouts.</p>
  
  <p>What I am doing wrong ?</p>
  
  <pre><code>        URL url = new URL(uri.toString());
      HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
      try
      {
          InputStream in = new BufferedInputStream(urlConnection.getInputStream());
          BufferedReader br = new BufferedReader(new InputStreamReader(in));
          StringBuilder sb = new StringBuilder();
          String line = null;
  
          while ((line = br.readLine()) != null) 
          {
              sb.append(line + "\n");
          }
          br.close();
  
          this.content = sb.toString();
      }      
      finally
      {
          urlConnection.disconnect();
      }
  </code></pre>
  
  <p>AND</p>
  
  <pre><code>    HttpGet get = new HttpGet(uri);
      HttpClient defaultHttp = new DefaultHttpClient(httpParameters);
      HttpResponse response = defaultHttp.execute(get);
  
      StatusLine status = response.getStatusLine();
      if(status.getStatusCode() == HttpStatus.SC_OK)
      {
          HttpEntity entity = response.getEntity();
          InputStream stream = entity.getContent();
              String encoding = "utf-8";      
  
          //long length = entity.getContentLength();
          //if(entity.getContentEncoding() != null)
          //{
          //  encoding = entity.getContentEncoding().getValue();
          //}
          //if(length &gt; 0)
          //{
              byte[] buffer = new byte[1024];
              long read = 0;
              do
              {
                  read = stream.read(buffer);
                  if(read &gt; 0)
                  {
                      this.content += new String(buffer, encoding);
                  }
              }while(read &gt; 0);
  
          //}
      }
  </code></pre>
  
  <p>@edit</p>
  
  <p>I've tried it with C# and WinForms. I read the complete html source of that webpage.
  With java-android it doesn't work.</p>
  
  <pre><code>        HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create("http://www.kicker.de");
          HttpWebResponse response = (HttpWebResponse)request.GetResponse();
          StreamReader reader = new StreamReader(response.GetResponseStream());
          string content = reader.ReadToEnd();
  
  
          reader.Close();
          response.Close();
  </code></pre>