title: How to get the size of an InputStream?
body: <p>I'm having an <code>InputStream</code> from a <code>ProcessBuilder</code> that acutally reads the <code>stdout</code> stream.</p>
  
  <p>Question: how can I know the size of that inmemory <code>InputStream</code>, so I can write it to a <code>HttpResponse</code> http header?</p>
  
  <pre><code>InputStream is = process.getInputStream();
  InputStreamReader isr = new InputStreamReader(is);
  BufferedReader br = new BufferedReader(isr);
  
  OutputStream out = response.getOutputStream();
  int bytes;
  while ((bytes = br.read()) != -1) {
      out.write(bytes);
  }
  
  //how can I know the size of the inmemory stream/file written?
  //response.setContentLength((int) pdfFile.length());
  </code></pre>