Interface IPayloadSerializer
- Namespace
- Azure.Iot.Operations.Protocol
- Assembly
- Azure.Iot.Operations.Protocol.dll
public interface IPayloadSerializer
Methods
FromBytes<T>(ReadOnlySequence<byte>, string?, MqttPayloadFormatIndicator)
Deserialize the provided payload.
T FromBytes<T>(ReadOnlySequence<byte> payload, string? contentType, MqttPayloadFormatIndicator payloadFormatIndicator) where T : class
Parameters
payload
ReadOnlySequence<byte>The byte array to deserialize.
contentType
stringThe content type of the MQTT message received with this payload.
payloadFormatIndicator
MqttPayloadFormatIndicatorThe payload format indicator of the MQTT message received with this payload.
Returns
- T
The deserialized object.
Type Parameters
T
The type to deserialize into.
ToBytes<T>(T?)
Serialize the provided object.
SerializedPayloadContext ToBytes<T>(T? payload) where T : class
Parameters
payload
TThe object to serialize
Returns
- SerializedPayloadContext
The serialized payload in a byte[] and the content type + payload format indicator used when serializing.
Type Parameters
T
The type to serialize