getCharacterCountIndicator method

int getCharacterCountIndicator()

returns the length in characters according to the specification (differs from getCharacterLength() in BYTE mode

Implementation

//  for multi byte encoded characters)
int getCharacterCountIndicator() {
  return mode == Mode.BYTE
      ? context.context.encoders
          .encode(
            context.context.stringToEncode.substring(
              fromPosition,
              fromPosition + characterLength,
            ),
            charsetEncoderIndex,
          )
          .length
      : characterLength;
}