A class that abstracts a pipe-like ArrayBuffer.

Constructors

Properties

Accessors

Methods

Constructors

  • Creates a new instance of a pipe

    Parameters

    • Optional buffer: ArrayBuffer

      an optional buffer to start with

    • Optional length: number

      an optional amount of bytes to use for the length.

    Returns utils.candid.PipeArrayBuffer

Properties

_view: any

The reading view. It's a sliding window as we read and write, pointing to the buffer.

_buffer: any

The actual buffer containing the bytes.

Accessors

  • get buffer(): ArrayBuffer
  • Returns ArrayBuffer

  • get byteLength(): number
  • Returns number

  • get end(): boolean
  • Whether or not there is more data to read from the buffer

    Returns boolean

Methods

  • Read num number of bytes from the front of the pipe.

    Parameters

    • num: number

      The number of bytes to read.

    Returns ArrayBuffer

  • Returns undefined | number

  • Write a buffer to the end of the pipe.

    Parameters

    Returns void

  • Allocate a fixed amount of memory in the buffer. This does not affect the view.

    Parameters

    • amount: number

      A number of bytes to add to the buffer.

    Returns void