Ticket #988 (assigned defect)
|Reported by:||ArcRiley||Owned by:||ArcRiley|
In order to support import/export methods for PySoy classes cleanly we need a class which can handle packing and unpacking data of arbitrary meaning and bit length.
Methods of this class may include;
read_uint(bits : int) : int to read a number of bits from the stream, from 1 to 32, and return them as an integer.
read_int(bits : int) : int to read 1 to 31 bits plus a sign bit (highest order)
read_bool() : bool is an alias for (bool) read_uint(1)
read_double() : double to read 64 bits and return a double
read_label() : string to read a byte for length then 0-255 bytes which are returned as a string.
read_nstring(bytes : int) : string reads the specified number of bytes and returns a string. Useful for when the format specifies fixed-length strings or in cases where strings of > 255 bytes are needed.
... and the write versions of these as well.
Byte packing should be in network byte order (most significant byte first) and converted to/from native byte order.