Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Decoder

Hierarchy

  • Decoder

Index

Constructors

constructor

  • new Decoder(protos: object): Decoder

Properties

buffer

buffer: Buffer

offset

offset: number = 0

protos

protos: any

Methods

decode

  • decode(route: string, buf: Buffer): object
  • Parameters

    • route: string
    • buf: Buffer

    Returns object

    • [key: string]: any

decodeArray

  • decodeArray(array: Array<any>, type: string, protos: object): void
  • Parameters

    • array: Array<any>
    • type: string
    • protos: object

    Returns void

decodeMsg

  • decodeMsg(msg: object, protos: object, length: number): object
  • Parameters

    • msg: object
      • [key: string]: any
    • protos: object
      • [key: string]: any
    • length: number

    Returns object

    • [key: string]: any

decodeProp

  • decodeProp(type: string, protos?: object): object
  • Parameters

    • type: string
    • Optional protos: object
      • [key: string]: any

    Returns object

getBytes

  • getBytes(flag?: boolean): number[]
  • Parameters

    • Optional flag: boolean

    Returns number[]

getHead

  • getHead(): object
  • Get property head from protobuf

    Returns object

    • tag: number
    • type: number

init

  • init(protos: object): void
  • Parameters

    • protos: object

    Returns void

isFinish

  • isFinish(msg: object, protos: object): boolean
  • Test if the given msg is finished

    Parameters

    • msg: object
    • protos: object
      • [key: string]: any

    Returns boolean

peekBytes

  • peekBytes(): number[]

peekHead

  • peekHead(): object
  • Get tag head without move the offset

    Returns object

    • tag: number
    • type: number

setProtos

  • setProtos(protos: object): void
  • Parameters

    • protos: object

    Returns void