jam.types.base.sequences.bytes.bytes module

class jam.types.base.sequences.bytes.bytes.Bytes(value: int | bool | bytes | str | bytearray | memoryview | Sequence)[source]

Bases: Vector[Byte]

Variable-length byte sequence type.

__init__(value: int | bool | bytes | str | bytearray | memoryview | Sequence)[source]

Initialize Bytes.

Parameters:

value – Bytable which is either int, bytes, str, bytearray, memoryview, Sequence[Byte]

hex() str[source]

Get hex representation of Bytes.

classmethod from_json(data: Any) Bytes[source]

Create from JSON representation.

static decode_from(buffer: bytes | bytearray | memoryview, offset: int = 0) Tuple[Vector[T], int]

Decode from buffer. Must be implemented by subclasses or added via decorator.

Parameters:
  • buffer – Buffer to decode from

  • offset – Starting position in buffer

Returns:

  • The decoded value

  • Number of bytes read

Return type:

Tuple containing