Skip to main content

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

NameTypeDescription
databytesThe raw byte sequence to be decoded into its original form.

Returns

TypeDescription
bytesThe decoded data.

encode()

@classmethod
def encode(
value: bytes
) - > bytes

Encode the data using the encoder.

Parameters

NameTypeDescription
valuebytesThe raw byte sequence to be processed and encoded.

Returns

TypeDescription
bytesThe encoded data.

get_json_format()

@classmethod
def get_json_format() - > str

Get the JSON format for the encoded data.

Returns

TypeDescription
strThe JSON format for the encoded data.