Decode a (utf-8 encoded) string from the encoded data. Returns: A string.
()
| 249 | return bytes_string |
| 250 | |
| 251 | def decode_string() -> str: |
| 252 | """Decode a (utf-8 encoded) string from the encoded data. |
| 253 | |
| 254 | Returns: |
| 255 | A string. |
| 256 | """ |
| 257 | size_bytes = b"" |
| 258 | while (byte := get_byte()) != b":": |
| 259 | size_bytes += byte |
| 260 | bytes_string = get_bytes(int(size_bytes)) |
| 261 | decoded_string = bytes_string.decode("utf-8", errors="replace") |
| 262 | return decoded_string |
| 263 | |
| 264 | def decode_list() -> list[object]: |
| 265 | """Decode a list. |