Implement Encoder.