gis-tools-ts - v0.6.0
    Preparing search index...

    Class BufferReader

    A buffer reader is an extension of a DataView with some extra methods

    Hierarchy

    • DataView<ArrayBufferLike>
      • BufferReader

    Implements

    Index

    Constructors

    • Parameters

      • buffer: ArrayBufferLike

        the input buffer

      • OptionalbyteOffset: number

        offset in the buffer

      • OptionalbyteLength: number

        length of the buffer

      Returns BufferReader

    Methods

    • Reads a 64-bit unsigned integer (biguint64) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns bigint

      The 64-bit unsigned integer as a bigint

    • Reads a 64-bit unsigned integer (biguint64) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns bigint

      The 64-bit unsigned integer as a bigint

    • Gets the Float16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.

      Parameters

      • byteOffset: number

        The place in the buffer at which the value should be retrieved.

      • OptionallittleEndian: boolean

        If false or undefined, a big-endian value should be read.

      Returns number

    • Retrieves a 16-bit floating point number (Float16) at the specified byte offset from the start of the view. This method reads two bytes from the buffer, converts them into a 16-bit floating-point number, and returns the corresponding 32-bit floating-point representation.

      Parameters

      • byteOffset: number

        The offset, in bytes, from the start of the DataView to read the value from.

      • OptionallittleEndian: boolean

        If true, the value is read as little-endian. Otherwise, it's read as big-endian.

      Returns number

      The converted 32-bit floating-point number (Float32) corresponding to the 16-bit value.

    • Reads a 32-bit floating-point number (float32) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns number

      The 32-bit floating-point number as a number

    • Reads a 64-bit floating-point number (float64) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns number

      The 64-bit floating-point number as a number

    • Reads a signed 16-bit integer (int16) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns number

      The 16-bit signed integer value as a number

    • Reads a signed 32-bit integer (int32) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns number

      The 32-bit signed integer value as a number

    • Reads a signed byte (int8) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      Returns number

      The byte value as a signed number

    • Reads a range from the buffer

      Parameters

      • offset: number

        the offset of the range

      • length: number

        the length of the range

      Returns Promise<Uint8Array<ArrayBufferLike>>

      • the ranged buffer
    • Reads an unsigned 16-bit integer (uint16) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns number

      The 16-bit unsigned integer value as a number

    • Reads an unsigned 32-bit integer (uint32) at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      • littleEndian: boolean = false

        Optional, specifies if the value is stored in little-endian format. Defaults to false (big-endian).

      Returns number

      The 32-bit unsigned integer value as a number

    • Reads a single byte at the given byteOffset

      Parameters

      • byteOffset: number = ...

        The position in the file to read from

      Returns number

      The byte value as a number

    • Reads a string from the buffer

      Parameters

      • byteOffset: number = ...

        Start of the string

      • byteLength: number = ...

        Length of the string

      Returns string

      • The string
    • Set the current position of the cursor

      Parameters

      • pos: number = 0

        where to adjust the current cursor

      Returns void

    • Fetch a slice at the current cursor position. The cursor is updated

      Parameters

      • size: number

        size of the slice

      Returns DataView

      • a DataView of the slice
    • Stores an Float16 value at the specified byte offset from the start of the view.

      Parameters

      • byteOffset: number

        The place in the buffer at which the value should be set.

      • value: number

        The value to set.

      • OptionallittleEndian: boolean

        If false or undefined, a big-endian value should be written.

      Returns void

    • Stores a 16-bit floating point number (Float16) at the specified byte offset in the DataView. This method converts a 32-bit floating-point number (Float32) to a 16-bit floating-point representation, then writes the resulting 16-bit value into the buffer at the specified offset.

      Parameters

      • byteOffset: number

        The offset, in bytes, at which to store the value.

      • value: number

        The 32-bit floating-point number (Float32) to be converted and stored as Float16.

      • OptionallittleEndian: boolean

        If true, the value is stored as little-endian. Otherwise, it's stored as big-endian.

      Returns void

    • Set the text decoder's encoding

      Parameters

      • encoding: string

        update the text decoder's encoding

      Returns void

    • Get a slice of the buffer

      Parameters

      • begin: number = ...

        beginning of the slice

      • end: number = ...

        end of the slice. If not provided, the end of the data is used

      Returns DataView

      • a DataView of the slice
    • Returns number

      • the current position of the cursor