Encode/decode to/from references to readers