Add method to parse data from input stream