title: Testing for empty InputStream in Java
body: <p>how do you guys test for an empty InputStream? I know that InputStream is designed to work with remote resources, so you can't know if it's there until you actually read from it. I cannot use read() because current position would change and using mark() and resetting for that seems to be inappropriate.</p>
  
  <p>The problem is, that sometimes one can't test if read() returns -1, because if you have a stream and some third party library uses it, you need to test if it is empty before you send it there.</p>
  
  <p>By empty InputStreams I mean these <code>new ByteArrayInputStream(new byte[0])</code></p>