Encoder and Deocder¶ Encoder Class¶ class gs_interactive.client.utils.Encoder(endian='little')[source]¶ A simple encoder to encode the data into bytes __init__(endian='little') → None[source]¶ get_bytes()[source]¶ Get the bytes from the byte array put_byte(value: int)[source]¶ Put a single byte into the byte array put_bytes(value: bytes)[source]¶ Put a byte array into the byte array put_double(value: float)[source]¶ Put a double into the byte array, 8 bytes put_int(value: int)[source]¶ Put an integer into the byte array, 4 bytes put_long(value: int)[source]¶ Put a long integer into the byte array, 8 bytes put_string(value: str)[source]¶ Put a string into the byte array, first put the length of the string, then the string Decoder Class¶ class gs_interactive.client.utils.Decoder(byte_array: bytearray, endian='little')[source]¶ A simple decoder to decode the bytes into data __init__(byte_array: bytearray, endian='little') → None[source]¶ get_byte() → int[source]¶ Get a single byte from the byte array returns: int get_bytes(length: int) → bytes[source]¶ Get a byte array from the byte array returns: A byte array get_double() → float[source]¶ Get a double from the byte array, 8 bytes returns: float get_int() → int[source]¶ Get an integer from the byte array, 4 bytes returns: int get_long() → int[source]¶ Get a long integer from the byte array, 8 bytes returns: int get_string() → str[source]¶ Get a string from the byte array, first get the length of the string, then the string returns: str is_empty() → bool[source]¶ Whether the byte array is empty