I have an InputStream that is set up to handle local files, but want to add the ability to read from a file over a network at a later time. I assume InputStream is geared for this already.

The problem I am having is, apparently InputStream is not guaranteed to have data available at any given time, and data may become available later. Not sure I'm understanding that correctly. There's no method to determine an absolute size of available data (as number of bytes) or even if the InputStream is closed. It seems like if there's a file there, it *must* have something available. A method that is handling the InputStream is probably going to read from it, and if no data is available, there isn't any reason to keep it around. What's worse is I can't even tell if there *is* any data available.

So my question is, for a file being read over a network or locally, how can I determine if it is open/closed, and possibly determine the size of the file on the other end? Why is this class so bare?