Improved buffer fill and EOF check in iterator input stream.