encodeCompressedGtinWithoutAI method

void encodeCompressedGtinWithoutAI(
  1. StringBuilder buf,
  2. int currentPos,
  3. int initialBufferPosition
)

Implementation

void encodeCompressedGtinWithoutAI(
  StringBuilder buf,
  int currentPos,
  int initialBufferPosition,
) {
  for (int i = 0; i < 4; ++i) {
    final currentBlock = generalDecoder.extractNumericValueFromBitArray(
      currentPos + 10 * i,
      10,
    );
    if (currentBlock ~/ 100 == 0) {
      buf.write('0');
    }
    if (currentBlock ~/ 10 == 0) {
      buf.write('0');
    }
    buf.write(currentBlock);
  }

  _appendCheckDigit(buf, initialBufferPosition);
}