EncoderProtocol
Protocol for encoding and decoding data to and from bytes.
Methods
decode()
@classmethod
def decode(
data: bytes
) - > bytes
Decode the data using the encoder.
Parameters
| Name | Type | Description |
|---|---|---|
| data | bytes | The raw byte sequence to be decoded into its original form. |
Returns
| Type | Description |
|---|---|
bytes | The decoded data. |
encode()
@classmethod
def encode(
value: bytes
) - > bytes
Encode the data using the encoder.
Parameters
| Name | Type | Description |
|---|---|---|
| value | bytes | The raw byte sequence to be processed and encoded. |
Returns
| Type | Description |
|---|---|
bytes | The encoded data. |
get_json_format()
@classmethod
def get_json_format() - > str
Get the JSON format for the encoded data.
Returns
| Type | Description |
|---|---|
str | The JSON format for the encoded data. |