05nelsonm / encoding

A Kotlin Multiplatform library for configurable, streamable, efficient and extensible Encoding/Decoding with support for base16/32/64.
Apache License 2.0
33 stars 5 forks source link

Clean up unnecessary conversions #76

Closed 05nelsonm closed 1 year ago

05nelsonm commented 1 year ago

Currently EncoderDecoder.Feed.consume is utilized for both Decoder.Feed and Encoder.Feed, and accepts a Byte for both operations. This results in a lot of conversions between Byte to Char and Char to Byte.

Because we can't specify the Char type using generics (JS does not do Chars), consume and consumeProtected must become wholly separate methods implemented on each Decoder.Feed and Encoder.Feed with the correct input types, Char and Byte respectively.

Furthermore, OutFeed should also be separate interfaces for each operation. Encoder.OutFeed which outputs a Char, and Decoder.OutFeed which outputs a Byte