Change methods name.
Simplify `encode()`
Change exceptional handling.
Cache encoding information when decoding.