Class EoWriter

A class for writing EO data to a sequence of bytes.

Hierarchy

  • EoWriter

Constructors

Properties

_length: number = 0
_stringSanitizationMode: boolean = false
data: Uint8Array = ...

Accessors

  • get length(): number
  • Gets the length of the writer data.

    Returns

    The length of the writer data

    Returns number

  • get stringSanitizationMode(): boolean
  • Gets the string sanitization mode for the writer

    Returns

    True if string sanitization is enabled

    Returns boolean

  • set stringSanitizationMode(stringSanitizationMode: boolean): void
  • Sets the string sanitization mode for the writer.

    With string sanitization enabled, the writer will switch `0xFF` bytes in strings (ΓΏ) to `0x79` (y).

    Parameters

    • stringSanitizationMode: boolean

      the new string sanitization mode

    Returns void

Methods

  • Adds a raw byte to the writer data.

    Throws

    Error if the value is above 0xFF.

    Parameters

    • value: number

      the byte to add

    Returns void

  • Adds an array of raw bytes to the writer data.

    Parameters

    • bytes: Uint8Array

      the array of bytes to add

    Returns void

  • Adds an encoded 1-byte integer to the writer data.

    Throws

    Error if the value is not below CHAR_MAX.

    Parameters

    • char: number

      the number to encode and add

    Returns void

  • Adds an encoded string to the writer data.

    Parameters

    • str: string

    Returns void

  • Adds a fixed-length encoded string to the writer data.

    Throws

    Error if the string does not have the expected length

    Parameters

    • str: string
    • length: number

      the expected length of the string

    • padded: boolean = false

      true if the string should be padded to the length with trailing 0xFF bytes

    Returns void

  • Adds a fixed-length string to the writer data.

    Throws

    Error if the string does not have the expected length

    Parameters

    • str: string
    • length: number

      the expected length of the string

    • padded: boolean = false

      true if the string should be padded to the length with trailing 0xFF bytes.

    Returns void

  • Adds an encoded 4-byte integer to the writer data.

    Throws

    Error if the value is not below INT_MAX.

    Parameters

    • int: number

    Returns void

  • Adds an encoded 2-byte integer to the writer data.

    Throws

    Error if the value is not below SHORT_MAX.

    Parameters

    • short: number

    Returns void

  • Adds a string to the writer data.

    Parameters

    • str: string

    Returns void

  • Adds an encoded 3-byte integer to the writer data.

    Throws

    Error if the value is not below THREE_MAX.

    Parameters

    • three: number

    Returns void

  • Parameters

    • bytes: Uint8Array
    • bytesLength: number = bytes.length

    Returns void

  • Gets the writer data as a byte array.

    Returns

    A copy of the writer data as a byte array

    Returns Uint8Array

  • Parameters

    • bytes: Uint8Array
    • length: number

    Returns Uint8Array

  • Parameters

    • value: number
    • max: number

    Returns void

  • Parameters

    • str: string
    • length: number
    • padded: boolean

    Returns void

Generated using TypeDoc