I want to know if an InputStream is empty, but without using the method read(). Is there a way to know if it\'s empty without reading from it?
You can use the available() method to ask the stream whether there is any data available at the moment you call it. However, that function isn't guaranteed to work on all types of input streams. That means that you can't use available() to determine whether a call to read() will actually block or not.