Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ArrayBufferWalker

A class that "walks" through an ArrayBuffer, either reading or writing values as it goes. Intended as a less performance-draining alternative to a DataView.

export
class

ArrayBufferWalker

Hierarchy

  • ArrayBufferWalker

Index

Constructors

constructor

  • Creates an instance of ArrayBufferWalker.

    memberof

    ArrayBufferWalker

    Parameters

    • bufferOrLength: ArrayBuffer | number

      either an existing ArrayBuffer or the length of a new array you want to use.

    Returns ArrayBufferWalker

Properties

array

array: Uint8Array

offset

offset: number = 0

The current index our walker is sat at. Can be modified.

memberof

ArrayBufferWalker

Methods

pauseAdler

  • pauseAdler(): void
  • ADLER32 is used in our ZLib blocks, but can span across multiple blocks. So sometimes we need to pause it in order to start a new block.

    memberof

    ArrayBufferWalker

    Returns void

readString

  • readString(length: any): string

readUint16

  • readUint16(littleEndian?: boolean): number

readUint32

  • readUint32(littleEndian?: boolean): number

readUint8

  • readUint8(): number

rewindString

  • rewindString(length: any): void

rewindUint32

  • rewindUint32(): void

skip

  • skip(length: any): void

startAdler

  • startAdler(): void
  • Similar to .startCRC(), this marks the start of a block we want to calculate the ADLER32 checksum of.

    memberof

    ArrayBufferWalker

    Returns void

startCRC

  • startCRC(): void

writeAdler

  • writeAdler(): void
  • Similar to .writeCRC(), this marks the end of an ADLER32 checksummed block, and writes the Uint32 checksum value to the ArrayBuffer.

    memberof

    ArrayBufferWalker

    Returns void

writeCRC

  • writeCRC(): void
  • After using .startCRC() to mark the start of a block, use this to mark the end of the block and write the UInt32 CRC value.

    memberof

    ArrayBufferWalker

    Returns void

writeString

  • writeString(value: any): void

writeUint16

  • writeUint16(value: any, littleEndian?: boolean): void

writeUint32

  • writeUint32(value: any, littleEndian?: boolean): void

writeUint8

  • writeUint8(value: any): void

Generated using TypeDoc