Table of Contents

Class StringDeserializer

Namespace
Solace.Serdes
Assembly
Solace.Serdes.dll

A deserializer for converting byte[] to strings using a specified character encoding.

public class StringDeserializer : IDeserializer<string>
Inheritance
StringDeserializer
Implements
Inherited Members

Fields

SolaceDeserializerStringEncoding

Configuration property key for specifying the string encoding. The value can be a string encoding name (e.g., "UTF-8", "UTF-16") or an Encoding instance.

public const string SolaceDeserializerStringEncoding = "solace.deserializer.string.encoding"

Field Value

string

Methods

Configure(IDictionary<string, object>)

Configures this StringDeserializer with the given properties.

public void Configure(IDictionary<string, object> properties)

Parameters

properties IDictionary<string, object>

A dictionary of configuration properties.

Remarks

The default encoding is UTF-8.

Supported configuration properties:

Exceptions

ArgumentNullException

Thrown when properties is null.

ArgumentException

Thrown when the encoding value is not a valid string or Encoding, or when the specified encoding name is not supported.

Deserialize(string, ReadOnlySpan<byte>, IDictionary<string, object>)

Deserializes the given byte payload to a string using the configured character encoding.

public string Deserialize(string destinationName, ReadOnlySpan<byte> payload, IDictionary<string, object> headers = null)

Parameters

destinationName string

The name of the destination (not used in this implementation).

payload ReadOnlySpan<byte>

The byte payload to deserialize.

headers IDictionary<string, object>

Optional headers (not used in this implementation).

Returns

string

The deserialized string. Returns an empty string if the payload is empty or null.

Remarks

The default encoding is UTF-8.

Note: ReadOnlySpan is non-nullable; null payloads become empty spans and return an empty string.