Table of Contents

Class CodecBytes

Namespace
Virtufin.Worker.DevKit.Codecs
Assembly
Virtufin.Worker.DevKit.dll

Turns an event's data into bytes for a binary codec (FlatBuffers, a compact venue frame, ...), whatever representation the transport left in Data: byte[], Memory<T>, ReadOnlyMemory<T>, ArraySegment<T> or a base64 string.

A binary decoder should call this rather than cast Data itself: a representation it did not expect becomes a PayloadDecodeException, never an InvalidCastException or a NullReferenceException.

public static class CodecBytes
Inheritance
CodecBytes
Inherited Members

Methods

From(CloudEvent)

The event's data as bytes.

public static byte[] From(CloudEvent cloudEvent)

Parameters

cloudEvent CloudEvent

Returns

byte[]

Exceptions

CodecException

The event is null, has no data, or its data is not binary.

TryFrom(CloudEvent, out byte[])

Try From(CloudEvent) without throwing; false for a non-binary payload.

public static bool TryFrom(CloudEvent cloudEvent, out byte[] bytes)

Parameters

cloudEvent CloudEvent
bytes byte[]

Returns

bool