appendBytes static method

void appendBytes(
  1. String content,
  2. Mode mode,
  3. BitArray bits,
  4. CharacterSetECI encoding,
)

Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".

Implementation

static void appendBytes(
    String content, Mode mode, BitArray bits, CharacterSetECI encoding) {
  switch (mode) {
    case Mode.numeric:
      appendNumericBytes(content, bits);
      break;
    case Mode.alphanumeric:
      appendAlphanumericBytes(content, bits);
      break;
    case Mode.byte:
      append8BitBytes(content, bits, encoding.encoding);
      break;
    case Mode.kanji:
      appendKanjiBytes(content, bits);
      break;
    case Mode.terminator:
    case Mode.fnc1FirstPosition:
    case Mode.fnc1SecondPosition:
    case Mode.structuredAppend:
    case Mode.eci:
    case Mode.hanzi:
      throw WriterException('Invalid mode: $mode');
  }
}