Added a parse() method for InputStream