Allow setting of file mode on DatabaseReader.

I switched away from public constructors to a Builder class. This should
provide flexibility in the future and help avoid confusing telescoping
constructors.
Added a test with memory mode and explicitly set default mode
Made the builder classes final