Fix last-line bug.

The exact number of bytes read through Read() was being ignored and the
entire buffer was being used.  This only affected the last line of input
that did not end with a newline.
Add a simple example.