Options
All
  • Public
  • Public/Protected
  • All
Menu
author

satorux@google.com (Satoru Takabayashi) - creator

author

dswitkin@google.com (Daniel Switkin) - ported from C++

Hierarchy

  • Encoder

Index

Constructors

Private constructor

Properties

Static Private ALPHANUMERIC_TABLE

ALPHANUMERIC_TABLE: Int32Array = Int32Array.from([-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0x00-0x0f-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0x10-0x1f36, -1, -1, -1, 37, 38, -1, -1, -1, -1, 39, 40, -1, 41, 42, 43, // 0x20-0x2f0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 44, -1, -1, -1, -1, -1, // 0x30-0x3f-1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, // 0x40-0x4f25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, -1, -1, -1, -1, -1, // 0x50-0x5f])

Static DEFAULT_BYTE_MODE_ENCODING

DEFAULT_BYTE_MODE_ENCODING: string = CharacterSetECI.UTF8.getName()

Methods

Static append8BitBytes

  • append8BitBytes(content: string, bits: BitArray, encoding: string): void

Static appendAlphanumericBytes

  • appendAlphanumericBytes(content: string, bits: BitArray): void

Static appendBytes

  • appendBytes(content: string, mode: Mode, bits: BitArray, encoding: string): void

Static Private appendECI

Static appendKanjiBytes

  • appendKanjiBytes(content: string, bits: BitArray): void

Static appendLengthInfo

Static appendModeInfo

Static appendNumericBytes

  • appendNumericBytes(content: string, bits: BitArray): void

Static Private calculateBitsNeeded

Static Private calculateMaskPenalty

  • calculateMaskPenalty(matrix: ByteMatrix): number

Static Private chooseMaskPattern

Static chooseMode

  • chooseMode(content: string, encoding?: string): Mode
  • Choose the best mode by examining the content. Note that 'encoding' is used as a hint; if it is Shift_JIS, and the input is only double-byte Kanji, then we return {@link Mode#KANJI}.

    Parameters

    • content: string
    • Default value encoding: string = null

    Returns Mode

Static Private chooseVersion

Static encode

Static generateECBytes

  • generateECBytes(dataBytes: Uint8Array, numEcBytesInBlock: number): Uint8Array

Static getAlphanumericCode

  • getAlphanumericCode(code: number): number
  • Parameters

    • code: number

    Returns number

    the code point of the table used in alphanumeric mode or -1 if there is no corresponding code in the table.

Static Private getDigit

  • getDigit(singleCharacter: string): number

Static getNumDataBytesAndNumECBytesForBlockID

  • getNumDataBytesAndNumECBytesForBlockID(numTotalBytes: number, numDataBytes: number, numRSBlocks: number, blockID: number, numDataBytesInBlock: Int32Array, numECBytesInBlock: Int32Array): void
  • Get number of data bytes and number of error correction bytes for block id "blockID". Store the result in "numDataBytesInBlock", and "numECBytesInBlock". See table 12 in 8.5.1 of JISX0510:2004 (p.30)

    Parameters

    • numTotalBytes: number
    • numDataBytes: number
    • numRSBlocks: number
    • blockID: number
    • numDataBytesInBlock: Int32Array
    • numECBytesInBlock: Int32Array

    Returns void

Static interleaveWithECBytes

  • interleaveWithECBytes(bits: BitArray, numTotalBytes: number, numDataBytes: number, numRSBlocks: number): BitArray
  • Interleave "bits" with corresponding error correction bytes. On success, store the result in "result". The interleave rule is complicated. See 8.6 of JISX0510:2004 (p.37) for details.

    Parameters

    • bits: BitArray
    • numTotalBytes: number
    • numDataBytes: number
    • numRSBlocks: number

    Returns BitArray

Static Private isDigit

  • isDigit(singleCharacter: string): boolean

Static Private isOnlyDoubleByteKanji

  • isOnlyDoubleByteKanji(content: string): boolean

Static Private recommendVersion

Static terminateBits

  • terminateBits(numDataBytes: number, bits: BitArray): void

Static Private willFit

Generated using TypeDoc