eolib - v2.0.1
    Preparing search index...

    Class EoWriter

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

    Index

    Constructors

    Accessors

    • get length(): number

      Gets the length of the writer data.

      Returns number

      The length of the writer data

    • get stringSanitizationMode(): boolean

      Gets the string sanitization mode for the writer

      Returns boolean

      True if string sanitization is enabled

    • 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.

      Parameters

      • value: number

        the byte to add

      Returns void

      Error if the value is above 0xFF.

    • 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.

      Parameters

      • char: number

        the number to encode and add

      Returns void

      Error if the value is not below CHAR_MAX.

    • Adds an encoded string to the writer data.

      Parameters

      • str: string

        the string to encoded and added

      Returns void

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

      Parameters

      • str: string

        the string to be encoded and added

      • 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

      Error if the string does not have the expected length

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

      Parameters

      • str: string

        the string to be added

      • 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

      Error if the string does not have the expected length

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

      Parameters

      • int: number

        the number to encode and add

      Returns void

      Error if the value is not below INT_MAX.

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

      Parameters

      • short: number

        the number to encode and add

      Returns void

      Error if the value is not below SHORT_MAX.

    • Adds a string to the writer data.

      Parameters

      • str: string

        the string to be added

      Returns void

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

      Parameters

      • three: number

        the number to encode and add

      Returns void

      Error if the value is not below THREE_MAX.

    • Gets the writer data as a byte array.

      Returns Uint8Array

      A copy of the writer data as a byte array