title: Java -- How to read an unknown number of bytes from an inputStream (socket/socketServer)?
body: <p>Looking to read in some bytes over a socket using an inputStream. The bytes sent by the server may be of variable quantity, and the client doesn't know in advance the length of the byte array. How may this be accomplished?</p>
  
  <p><pre><code>
  byte b[]; 
  sock.getInputStream().read(b);
  </pre></code></p>
  
  <p>This causes a 'might not be initialized error' from the Net BzEAnSZ. Help.</p>