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.AttachmentHeaderAttachmentData.AttachmentJwsAttachmentData.AttachmentJwsDataAttachmentData.AttachmentBase64AttachmentData.AttachmentLinkDataAttachmentData.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.AttachmentHeaderobjects{ "protected": ..., "signature": ... }forAttachmentData.AttachmentJwsobjects{ "base64": ..., "jws": ... }forAttachmentData.AttachmentJwsDataobjects{ "base64": ... }forAttachmentData.AttachmentBase64objects{ "links": ..., "hash": ... }forAttachmentData.AttachmentLinkDataobjects{ "data": ... }forAttachmentData.AttachmentJsonDataobjects
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.