@tgsnake/skema
    Preparing search index...

    Class Int

    Int, Long, Int128, and Int256 are classes representing various integer types. They provide methods to read and write these integers in a specified format.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    _slots: string[]

    Internal array of slot names for the object.

    className: string

    Name of the class.

    classType: string

    Type of the class.

    cls: any = ...

    Reference to the constructor of the current class (late static binding).

    constructorId: number

    Unique identifier for the constructor.

    subclassOfId: number

    Identifier for the parent class (if any).

    SIZE: number = 4

    Methods

    • Reads data from the provided BytesIO instance and processes it using the associated class's read method.

      Parameters

      • data: BytesIO

        The BytesIO instance containing the data to be read.

      • ...args: any[]

        Additional arguments to be passed to the class's read method.

      Returns Promise<any>

      A promise that resolves with the result of the read operation.

    • Serializes the provided arguments using the associated class's write method.

      Parameters

      • ...args: any[]

        The arguments to be serialized.

      Returns Buffer

      The resulting Buffer after serialization.

    • Reads an integer value from the given BytesIO stream according to the specified options.

      Parameters

      • data: BytesIO

        The BytesIO instance to read from.

      • signed: boolean = true

        Whether to read the value as a signed integer. Defaults to true.

      • little: boolean = true

        Whether to use little-endian byte order. Defaults to true.

      • size: number = Int.SIZE

        The number of bytes to read. Defaults to Int.SIZE.

      Returns Promise<number>

      A promise that resolves to the read integer value.

    • Serializes a 32-bit integer value into a Buffer.

      Parameters

      • value: number | bigint

        The integer value to write. Can be a number or bigint.

      • signed: boolean = true

        Whether the integer should be written as signed (true) or unsigned (false). Defaults to true.

      • little: boolean = true

        Whether to use little-endian (true) or big-endian (false) byte order. Defaults to true.

      Returns Buffer

      A Buffer containing the serialized 32-bit integer.