Class BinaryWrapperSerializer

Assembly: redb.Route.dll

Base for data formats that wrap bytes rather than serialize an object model (Base64, GZip, Zip).
Marshal accepts a byte[], a string (UTF-8) or a ;
Unmarshal yields byte[], string, or object (bytes).
Anything else is an error that names the format, not a NullReferenceException later.

public abstract class BinaryWrapperSerializer : IMessageSerializer

Inheritance

Object→BinaryWrapperSerializer

Implements

Derived

Properties

ContentType

Content type this serializer handles (e.g., "application/json").

public abstract string ContentType { get; }

FormatName

Short format name for error messages (GZip).

protected abstract string FormatName { get; }

MediaTypes

All media types this serializer can handle, including structured-suffix aliases

public virtual IReadOnlyCollection<string> MediaTypes { get; }

WrapsBytes

true for a format whose input is raw bytes rather than an object model (Base64, GZip, Zip):

public bool WrapsBytes { get; }

Methods

Decode(byte[])

Unwraps the data (decode / decompress).

protected abstract byte[] Decode(byte[] data)

Deserialize(byte[], Type)

Deserializes a byte array to a typed value.

public object? Deserialize(byte[] data, Type type)

Deserialize<T>(byte[])

Deserializes a byte array to a typed value.

public T? Deserialize<T>(byte[] data)

Encode(byte[])

Wraps the payload (encode / compress).

protected abstract byte[] Encode(byte[] payload)

ReadBounded(Stream, long, string)

Copies the decoded source into a buffer, refusing to grow past

protected static byte[] ReadBounded(Stream source, long limit, string formatName)

Serialize<T>(T)

Serializes a value to a byte array.

public byte[] Serialize<T>(T value)