Attachment Data Serializer
The AttachmentDataSerializer
is responsible for serializing and deserializing instances of AttachmentData
.
To serialize an AttachmentData
object, use the serialize
function. This function takes an Encoder
and the AttachmentData
object to be serialized as parameters. It delegates the serialization to the appropriate serializer based on the type of the AttachmentData
object. The supported types are:
AttachmentData.AttachmentHeader
AttachmentData.AttachmentJws
AttachmentData.AttachmentJwsData
AttachmentData.AttachmentBase64
AttachmentData.AttachmentLinkData
AttachmentData.AttachmentJsonData
To deserialize an AttachmentData
object, use the deserialize
function. This function takes a Decoder
as a parameter. It first checks the JSON object read from the decoder to determine the type of the AttachmentData
object. It then uses the appropriate deserializer to deserialize the JSON object into the corresponding AttachmentData
subclass. The supported JSON object structures are:
{ "children": ... }
forAttachmentData.AttachmentHeader
objects{ "protected": ..., "signature": ... }
forAttachmentData.AttachmentJws
objects{ "base64": ..., "jws": ... }
forAttachmentData.AttachmentJwsData
objects{ "base64": ... }
forAttachmentData.AttachmentBase64
objects{ "links": ..., "hash": ... }
forAttachmentData.AttachmentLinkData
objects{ "data": ... }
forAttachmentData.AttachmentJsonData
objects
If the JSON object does not match any of the supported structures, a SerializationException
is thrown.
Properties
Functions
Deserializes a JSON representation of AttachmentData into an AttachmentData object.
Serializes the given AttachmentData object using the provided Encoder.