Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ArrayAccumulator

An implementation of the AbstractAccumulator that accumulates array values

Hierarchy

Index

Constructors

constructor

  • Create an ArrayAccumulator

    Parameters

    • tokeniser: Tokeniser

      the CBOR tokeniser

    • base: JSONPointer

      the base JSON pointer to accumulate from

    • start: number

      the offset of the start token

    • next: number

      the index of the next token

    Returns ArrayAccumulator

Properties

nextOffset

nextOffset: number

The buffer position of the next token

Readonly startOffset

startOffset: number

The buffer position of the start token

Protected Readonly tokeniser

tokeniser: Tokeniser

The CBOR tokeniser

Methods

accumulated

  • accumulated(): number
  • Get the number of accumulated tokens

    Returns number

    the number of accumulated tokens

add

  • add(next: number): boolean
  • Add tokens to the accumulator

    Parameters

    • next: number

      the next offset up to which to add tokens

    Returns boolean

    false

currentPointer

newArray

  • Create a new ArrayAccumulator from the current token position

    Parameters

    • start: number

      the offset of the start token

    • next: number

      the index of the next token

    Returns ArrayAccumulator

    a new array accumulator

newObject

  • Create a new ObjectAccumulator from the current token position

    Parameters

    • start: number

      the offset of the start token

    • next: number

      the index of the next token

    Returns ObjectAccumulator

    a new object accumulator

notEmptyAndSplitBy

  • notEmptyAndSplitBy(offset: number): boolean
  • Check if the offset splits the accumulator content

    Parameters

    • offset: number

      the offset to check

    Returns boolean

    true if the accumulator has encountered any tokens and the offset is greater than the starting offset

setNextStart

  • setNextStart(offset: number): void
  • Increase the next offset without adding tokens

    Parameters

    • offset: number

    Returns void

skip

  • skip(): void
  • Skip one token

    Returns void

splitStructureEnd

take

  • inheritdoc

    Parameters

    Returns void

takeAll

  • Take all tokens. Passes all accumulated tokens to the abstract take method.

    Parameters

    Returns void

toString

  • toString(): string
  • Convert the accumulator to a string

    Returns string

    a string representation of the accumulator

total

  • total(): number
  • Get the total number of tokens encountered

    Returns number

    the total number of tokens encountered

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.