Options
All
  • Public
  • Public/Protected
  • All
Menu

Class StringReader

class

StringReader

classdesc

A string helper used to read given string as bytes.2 chars as one byte.

param

The string to read.

Hierarchy

  • StringReader

Index

Constructors

constructor

Properties

pos

pos: number

size

size: number

str

str: string

Methods

isEmpty

  • isEmpty(): boolean
  • Checks if reached the end of the string.

    Returns boolean

read

  • read(bytes: number): string
  • Reads some bytes.

    Parameters

    • bytes: number

      Number of bytes to read

    Returns string

readInt

  • readInt(): number
  • Read 4 bytes as int in littleEndian

    Returns number

readLong

  • readLong(): number
  • Read 8 bytes as long in littleEndian

    Returns number

readNextBytes

  • readNextBytes(): string
  • First, read one byte as the length of bytes to read. Then read the following bytes.

    Returns string

readNextLen

  • readNextLen(): number
  • Reads one byte as int, which may indicates the length of following bytes to read.

    Returns number

readNullTerminated

  • readNullTerminated(): string
  • Reads string terminated by NULL.

    Returns string

readUint16

  • readUint16(): number
  • read 2 bytes as uint16 in littleEndian

    Returns number

readUint32

  • readUint32(): number
  • Read 4 bytes as uint32 in littleEndian

    Returns number

readUint8

  • readUint8(): number

unreadBytes

  • unreadBytes(bytes: number): void
  • Parameters

    • bytes: number

    Returns void

Generated using TypeDoc