title: Reading HttpURLConnection InputStream - manual buffer or BufferedInputStream?
body: <p>When reading the InputStream of an HttpURLConnection, is there any reason to use one of the following over the other? I've seen both used in examples.</p>
  
  <p><strong>Manual Buffer:</strong></p>
  
  <pre><code>while ((length = inputStream.read(buffer)) &gt; 0) {
      os.write(buf, 0, ret);
  }
  </code></pre>
  
  <p><strong>BufferedInputStream</strong></p>
  
  <pre><code>is = http.getInputStream();
  bis = new BufferedInputStream(is);
  ByteArrayBuffer baf = new ByteArrayBuffer(50);
  
  int current = 0;
  while ((current = bis.read()) != -1) {
       baf.append(current);
  }
  </code></pre>
  
  <p><strong>EDIT</strong> I'm still new to HTTP in general but one consideration that comes to mind is that if I am using a persistent HTTP connection, I can't just read until the input  stream is empty right? In that case, wouldn't I need to read the message length and just read the input stream for that length?</p>
  
  <p>And similarly, if NOT using a persistent connection, is the code I included 100% good to go in terms of reading the stream properly?</p>