pseudocode of byte buffered reader