title: Read a constant number of characters from a BufferedReader over a socket in Java
body: <p>I've set up a socket client in Java and am reading in data using a <code>BufferedReader</code>. I am aware that the <code>reader.readLine()</code> method will read a single line of input from the stream. However, I would like to read a constant number of characters into a string, or until the end of the stream, regardless of the content of the data read.</p>
  
  <p>For example:</p>
  
  <pre><code>BufferedReader reader = ...
  String data = /* next 1024 characters from the stream */
  </code></pre>