Serializable
Abstract base class for serializable objects.
Usage
Serializable()Subclasses must implement to_bytes and from_bytes.
Methods
| Name | Description |
|---|---|
| from_bytes() | Deserialize from bytes. |
| size() | Get the serialized size. |
| to_bytes() | Serialize this object to bytes. |
from_bytes()
Deserialize from bytes.
Usage
from_bytes(data)Parameters
data: bytes-
The bytes to deserialize.
Returns
Serializable-
A new instance.
size()
Get the serialized size.
Usage
size()Returns
int-
Size in bytes.
to_bytes()
Serialize this object to bytes.
Usage
to_bytes()Returns
bytes-
The serialized representation.