added suggested changes

- made encodeInternal method static
- added separate byte objects for CR and LF to avoid array access