embutils.utils.serialized module
Serialized object abstract implementation. In this context serialize is converting data to/from bytes.
- date
2021
- author
Christian Wiche
- contact
- license
The MIT License (MIT)
- class embutils.utils.serialized.AbstractSerialized[source]
Bases:
abc.ABCSerialized object abstraction. This class implements the expected interface for a serialized object.
- _abc_impl = <_abc_data object>
- abstract classmethod deserialize(data: bytearray) Optional[embutils.utils.serialized.AbstractSerialized][source]
Deserializes an object from a bytearray.
- Parameters
data (bytearray) – Data to extract the object from.
- Returns
Deserialized object if available, None otherwise.
- Return type
Optional[“AbstractSerialized”]
- class embutils.utils.serialized.AbstractSerializedCodec[source]
Bases:
abc.ABCSerialized object codec abstraction. This class implements the logic used to encode/decode a serialized object.
- _abc_impl = <_abc_data object>
- abstract decode(data: bytearray) Optional[embutils.utils.serialized.AbstractSerialized][source]
Decodes a serialized object from a byte array.
- Parameters
data (bytearray) – Bytes to decode.
- Returns
Deserialized object if able, None otherwise.
- Return type
Optional[AbstractSerialized]
- abstract encode(data: embutils.utils.serialized.AbstractSerialized) bytearray[source]
Encodes a serialized object into a byte array.
- Parameters
data (AbstractSerialized) – Object to encode.
- Returns
Encoded serialized data.
- Return type
bytearray