Add Encoder class

Add Encoder class.