Implemented available() method for input streams