Streaming, --encoding, --ntriples, refactoring

Cleaned up Fadi Maali's work on streaming. As a result, we no longer
read the entire input into memory for processing. This now also works
on the CLI.

Added a --encoding argument for overriding the character encoding
auto-detection.

Added a --ntriples option for choosing N-Triples output.

Some significant refactoring to make all of the above work.