Unpacker Objects

Unpacker is the complementary class which unpacks XDR data values from a string buffer, and has the following methods:


\begin{funcdesc}{__init__}{data}
Instantiates an \code{Unpacker} object with the string buffer
\var{data}.
\end{funcdesc}


\begin{funcdesc}{reset}{data}
Resets the string buffer with the given \var{data}.
\end{funcdesc}


\begin{funcdesc}{get_position}{}
Returns the current unpack position in the data buffer.
\end{funcdesc}


\begin{funcdesc}{set_position}{position}
Sets the data buffer unpack position to...
...eful about using \code{get_position()} and \code{set_position()}.
\end{funcdesc}


\begin{funcdesc}{done}{}
Indicates unpack completion. Raises an \code{xdrlib.Error} exception
if all of the data has not been unpacked.
\end{funcdesc}

In addition, every data type that can be packed with a Packer, can be unpacked with an Unpacker. Unpacking methods are of the form unpack_type, and take no arguments. They return the unpacked object. The same caveats apply for unpack_float and unpack_double as above.


\begin{funcdesc}{unpack_float}{}
Unpacks a single-precision floating point number.
\end{funcdesc}


\begin{funcdesc}{unpack_double}{}
Unpacks a double-precision floating point number, similarly to
\code{unpack_float}.
\end{funcdesc}

In addition, the following methods unpack strings, bytes, and opaque data:


\begin{funcdesc}{unpack_fstring}{n}
Unpacks and returns a fixed length string. \...
...adding with null bytes to guaranteed 4 byte
alignment is assumed.
\end{funcdesc}


\begin{funcdesc}{unpack_fopaque}{n}
Unpacks and returns a fixed length opaque data stream, similarly to
\code{unpack_fstring}.
\end{funcdesc}


\begin{funcdesc}{unpack_string}{}
Unpacks and returns a variable length string. ...
...ger, then the string data
is unpacked with \code{unpack_fstring}.
\end{funcdesc}


\begin{funcdesc}{unpack_opaque}{}
Unpacks and returns a variable length opaque data string, similarly to
\code{unpack_string}.
\end{funcdesc}


\begin{funcdesc}{unpack_bytes}{}
Unpacks and returns a variable length byte stream, similarly to
\code{unpack_string}.
\end{funcdesc}

The following methods support unpacking arrays and lists:


\begin{funcdesc}{unpack_list}{unpack_item}
Unpacks and returns a list of homogen...
...{unpack_item} is the
function that is called to unpack the items.
\end{funcdesc}


\begin{funcdesc}{unpack_farray}{n\, unpack_item}
Unpacks and returns (as a list)...
...e, \var{unpack_item} is the function used to unpack each element.
\end{funcdesc}


\begin{funcdesc}{unpack_array}{unpack_item}
Unpacks and returns a variable lengt...
..., then
each element is unpacked as in \code{unpack_farray} above.
\end{funcdesc}