Separated encoding and decoding from RoundTrip. This has lost some error
checking which should be re-added.
Fixed a bug w.r.t. huffman encoding where the wrong bits of EOS were
appended to the end of the byte, causing potential data corruption.
Various other fixups.