12.17.2 Unpacker Objects
The Unpacker class offers the following methods:
Resets the string buffer with the given data.
Returns the current unpack position in the data buffer.
Sets the data buffer unpack position to position. You should be
careful about using get_position() and set_position().
Returns the current unpack data buffer as a string.
Indicates unpack completion. Raises an Error exception
if all of the data has not been unpacked.
In addition, every data type that can be packed with a Packer,
can be unpacked with an Unpacker. Unpacking methods are of the
unpack_type(), and take no arguments. They return the
Unpacks a single-precision floating point number.
Unpacks a double-precision floating point number, similarly to
In addition, the following methods unpack strings, bytes, and opaque
Unpacks and returns a fixed length string. n is the number of
characters expected. Padding with null bytes to guaranteed 4 byte
alignment is assumed.
Unpacks and returns a fixed length opaque data stream, similarly to
Unpacks and returns a variable length string. The length of the
string is first unpacked as an unsigned integer, then the string data
is unpacked with unpack_fstring().
Unpacks and returns a variable length opaque data string, similarly to
Unpacks and returns a variable length byte stream, similarly to
The following methods support unpacking arrays and lists:
Unpacks and returns a list of homogeneous items. The list is unpacked
one element at a time
by first unpacking an unsigned integer flag. If the flag is
then the item is unpacked and appended to the list. A flag of
0 indicates the end of the list. unpack_item is the
function that is called to unpack the items.
Unpacks and returns (as a list) a fixed length array of homogeneous
items. n is number of list elements to expect in the buffer.
As above, unpack_item is the function used to unpack each element.
Unpacks and returns a variable length list of homogeneous items.
First, the length of the list is unpacked as an unsigned integer, then
each element is unpacked as in unpack_farray() above.
See About this document... for information on suggesting changes.