Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BinaryDataTypeImpl

A data type for binary data

Hierarchy

Implements

Index

Constructors

constructor

Properties

Readonly Binary

Binary: {} = BinaryImpl

The implementation of the underlying value type

Type declaration

Readonly valueClass

valueClass: {}

The constructor function creating the value type

param

the arguments to the constructor

returns

a new value object

Type declaration

Methods

binaryDeltaType

canReadAs

  • canReadAs(valueClass: {}): boolean
  • inheritdoc

    Parameters

    • valueClass: {}

    Returns boolean

deltaType

from

name

  • name(): string
  • The external type identifier.

    Returns string

    the name of this datatype

readAs

  • readAs<T>(valueClass: {}, buffer: Uint8Array | Bytes, offset?: undefined | number, length?: undefined | number): T
  • inheritdoc

    Type parameters

    • T

    Parameters

    • valueClass: {}
    • buffer: Uint8Array | Bytes
    • Optional offset: undefined | number
    • Optional length: undefined | number

    Returns T

readValue

  • readValue(buffer: Uint8Array | Bytes, offset?: undefined | number, length?: undefined | number): Binary | null
  • inheritdoc

    Parameters

    • buffer: Uint8Array | Bytes
    • Optional offset: undefined | number
    • Optional length: undefined | number

    Returns Binary | null

toBytes

  • Convert a value to bytes

    throws

    an error if the supplied value could not be converted

    Parameters

    • value: Uint8Array | Binary

      the value

    Returns Bytes

    a CBOR representation of the value

toString

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

    Returns string

    a string representation of the AbstractDataType

writeValue

  • writeValue(value: (Uint8Array | Binary) | undefined | null): Buffer
  • Serialise a value to binary

    throws

    an IllegalArgumentError if the value cannot be serialised

    deprecated

    since version 6.11. Buffer has been replaced by Uint8Array. Use writeValueToArray instead. This will be removed in a future release.

    Parameters

    • value: (Uint8Array | Binary) | undefined | null

      the value to serialise. For primitive and JSON datatypes the value can be undefined or null. In this case a null value will be serialised.

    Returns Buffer

    the serialised value as a buffer

writeValueToArray

  • writeValueToArray(value: (Uint8Array | Binary) | undefined | null): Uint8Array
  • Serialise a value to binary

    throws

    an IllegalArgumentError if the value cannot be serialised

    Parameters

    • value: (Uint8Array | Binary) | undefined | null

      the value to serialise. For primitive and JSON datatypes the value can be undefined or null. In this case a null value will be serialised.

    Returns Uint8Array

    the serialised value as a buffer

Copyright © 2025 DiffusionData Ltd. All Rights Reserved.