MCPcopy
hub / github.com/zxing-js/library / appendLengthInfo

Method appendLengthInfo

src/core/qrcode/encoder/Encoder.ts:492–498  ·  view source on GitHub ↗

* Append length info. On success, store the result in "bits".

(numLetters: number /*int*/, version: Version, mode: Mode, bits: BitArray)

Source from the content-addressed store, hash-verified

490 * Append length info. On success, store the result in "bits".
491 */
492 public static appendLengthInfo(numLetters: number /*int*/, version: Version, mode: Mode, bits: BitArray): void /*throws WriterException*/ {
493 const numBits = mode.getCharacterCountBits(version);
494 if (numLetters >= (1 << numBits)) {
495 throw new WriterException(numLetters + ' is bigger than ' + ((1 << numBits) - 1));
496 }
497 bits.appendBits(numLetters, numBits);
498 }
499
500 /**
501 * Append "bytes" in "mode" mode (encoding) into "bits". On success, store the result in "bits".

Callers 2

encodeMethod · 0.95
Encoder.spec.tsFile · 0.80

Calls 2

getCharacterCountBitsMethod · 0.80
appendBitsMethod · 0.80

Tested by

no test coverage detected