Allow std::cin and other streams to be used. Fixes #1.

Rather than using tellg and read it uses rdbuf instead which works
with stdin too.