Add the encoder class and supporting files

Resolves #1