add config.Encode/Decode

* allows use of Reader/Writer instead of requiring files and temp files.
* allows more isolated testing