getBits method

void getBits(
  1. BitArray bits
)

appends the bits

Implementation

void getBits(BitArray bits) {
  bits.appendBits(mode.bits, 4);
  if (characterLength > 0) {
    final length = getCharacterCountIndicator();
    bits.appendBits(length, mode.getCharacterCountBits(context.version));
  }
  if (mode == Mode.eci) {
    bits.appendBits(
      context.context.encoders.getECIValue(charsetEncoderIndex),
      8,
    );
  } else if (characterLength > 0) {
    // append data
    Encoder.appendBytes(
      context.context.stringToEncode.substring(
        fromPosition,
        fromPosition + characterLength,
      ),
      mode,
      bits,
      context.context.encoders.getCharset(charsetEncoderIndex),
    );
  }
}