Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ByteReader

Provides an API for reading through a byte array.

Hierarchy

  • ByteReader

Index

Constructors

constructor

  • Parameters

    • b: Uint8Array

    Returns ByteReader

Methods

addr

  • addr(): number
  • Return the byte address of the next byte to be read.

    Returns number

read

  • read(): number
  • Return the next byte, or EOF on end of array.

    Returns number

readBytes

  • readBytes(length: number): Uint8Array
  • Returns the next "length" bytes. If the returned array is shorter than "length", then we hit EOF.

    Parameters

    • length: number

    Returns Uint8Array

readShort

  • readShort(allowEofAfterFirstByte: boolean): number
  • Reads a little-endian short (two-byte) integer.

    Parameters

    • allowEofAfterFirstByte: boolean

      if true, an EOF after the first byte will result in just the first byte. Otherwise an EOF is returned.

    Returns number

    the integer, or EOF on end of file.

readString

  • readString(length: number): string
  • Reads an ASCII string from the stream. If the returned string is shorter than "length", then we hit EOF.

    Parameters

    • length: number

    Returns string

Generated using TypeDoc