add config.Encode/Decode

* allows use of Reader/Writer instead of requiring files and temp files.
* allows more isolated testing

This should make issue #39 easier to solve because file operations and Encode/Decode operations are separated.