buffer the input stream