title: bufferedreader - read into stringbuffer and not string
body: <p>I have the following code.  What I would like to do is read each line from the BufferedReader directly into a StringBuffer to reduce memory overhead.  Once it gets to the end of the data stream I would like it to exit the while loop.</p>
  
  <pre><code>StringBuffer line = new StringBuffer();
          URL url = new URL("a url");
          BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
                  int count = 0;
                  while(line.append(reader.readLine()) != null){
                      System.out.println(line.toString());
                      line.delete(0,line.length());
                  }
  </code></pre>
  
  <p>It reads the stream fine but when I get to the end of the stream it returns null and keeps printing null without exiting the loop.  Any </p>