title: How is InputStream managed in memory?
body: <p>I am familiar with the concept of <code>InputStream</code>,buffers and why they are useful <em>(when you need to work with data that might be larger then the machines RAM for example)</em>.</p>
  
  <p>I was wondering though, how does the <code>InputStream</code> actually carry all that data?. Could a <code>OutOfMemoryError</code> be caused if there is TOO much data being transfered? </p>
  
  <h1>Case-scenario</h1>
  
  <p>If I connect from a client to a server,requesting a 100GB file, the server starts iterating through the bytes of the file with a buffer, and writing the bytes back to the client with <code>outputStream.write(byte[])</code>. The client is not ready to read the <code>InputStream</code> right now,for whatever reason. Will the server continue sending the bytes of the file indefinitely? and if so, won't the <code>outputstream/inputstream</code> be larger than the RAM of one of these machines?</p>