getBaseXResliceCodec function

VariableSizeCodec<String, String> getBaseXResliceCodec(
  1. String alphabet,
  2. int bits
)

Returns a codec for encoding and decoding base-X strings using bit re-slicing.

This codec serializes strings by dividing the input into custom-sized bit chunks, mapping them to a given alphabet, and encoding the result into bytes. It is particularly suited for encoding schemes where the alphabet's length is a power of 2, such as base-16 or base-64.

Implementation

VariableSizeCodec<String, String> getBaseXResliceCodec(
  String alphabet,
  int bits,
) {
  return combineCodec(
        getBaseXResliceEncoder(alphabet, bits),
        getBaseXResliceDecoder(alphabet, bits),
      )
      as VariableSizeCodec<String, String>;
}