xdrlib โ Implements (a subset of) Sun XDR (eXternal Data Representation).
| Use Case | Command | Description |
|---|---|---|
| ๐ง Create a packer | packer = xdrlib.Packer() | Initialise an XDR packer |
| ๐ฆ Pack an integer | packer.pack_int(42) | Encode a signed integer |
| ๐ฆ Pack a string | packer.pack_string("hello") | Encode a variableโlength string |
| ๐ฆ Pack a float | packer.pack_float(3.14) | Encode a singleโprecision float |
| ๐ฆ Pack a double | packer.pack_double(2.718) | Encode a doubleโprecision float |
| ๐ฆ Pack an array | packer.pack_array(my_list, packer.pack_int) | Encode a variableโlength array |
| ๐ค Get packed bytes | data = packer.get_buffer() | Retrieve the encoded data |
| ๐ Create an unpacker | unpacker = xdrlib.Unpacker(data) | Initialise an XDR unpacker |
| ๐ฌ Unpack an integer | unpacker.unpack_int() | Decode a signed integer |
| ๐ฌ Unpack a string | unpacker.unpack_string() | Decode a variableโlength string |
| ๐ฌ Unpack a float | unpacker.unpack_float() | Decode a singleโprecision float |
| ๐ฌ Unpack an array | unpacker.unpack_array(unpacker.unpack_int) | Decode a variableโlength array |
| ๐ Reset packer | packer.reset() | Clear the packer buffer |
| ๐ Reset unpacker | unpacker.reset(data) | Reset unpacker with new data |
https://docs.python.org/3.10/library/xdrlib.html
The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.
See: RFC 1014
builtins.Exception(builtins.BaseException) โ Error โ ConversionError
builtins.object โ Packer
builtins.object โ Unpacker
ConversionError(msg)
Method resolution order:
Methods inherited from Error:
__init__(self, msg) โ Initialize self. See help(type(self)) for accurate signature.__repr__(self) โ Return repr(self).__str__(self) โ Return str(self).Data descriptors inherited from Error:
__weakref__ โ list of weak references to the object (if defined)Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type โ Create and return a new object. See help(type) for accurate signature.Methods inherited from builtins.BaseException:
__delattr__(self, name, /) โ Implement delattr(self, name).__getattribute__(self, name, /) โ Return getattr(self, name).__reduce__(...) โ Helper for pickle.__setattr__(self, name, value, /) โ Implement setattr(self, name, value).__setstate__(...)with_traceback(...) โ Exception.with_traceback(tb) โ set self.__traceback__ to tb and return self.Data descriptors inherited from builtins.BaseException:
__cause__ โ exception cause__context__ โ exception context__dict____suppress_context____traceback__argsError(msg)
Exception class for this module. Use:
except xdrlib.Error as var:
# var has the Error instance for the exception
Public ivars: msg โ contains the message
Method resolution order:
Methods defined here:
__init__(self, msg) โ Initialize self. See help(type(self)) for accurate signature.__repr__(self) โ Return repr(self).__str__(self) โ Return str(self).Data descriptors defined here:
__weakref__ โ list of weak references to the object (if defined)Static methods inherited from builtins.Exception:
__new__(*args, **kwargs) from builtins.type โ Create and return a new object. See help(type) for accurate signature.Methods inherited from builtins.BaseException:
__delattr__(self, name, /) โ Implement delattr(self, name).__getattribute__(self, name, /) โ Return getattr(self, name).__reduce__(...) โ Helper for pickle.__setattr__(self, name, value, /) โ Implement setattr(self, name, value).__setstate__(...)with_traceback(...) โ Exception.with_traceback(tb) โ set self.__traceback__ to tb and return self.Data descriptors inherited from builtins.BaseException:
__cause__ โ exception cause__context__ โ exception context__dict____suppress_context____traceback__argsPack various data representations into a buffer.
Methods defined here:
__init__(self) โ Initialize self. See help(type(self)) for accurate signature.get_buf = get_buffer(self)get_buffer(self)pack_array(self, list, pack_item)pack_bool(self, x)pack_bytes = pack_string(self, s)pack_double(self, x)pack_enum = pack_int(self, x)pack_farray(self, n, list, pack_item)pack_float(self, x)pack_fopaque = pack_fstring(self, n, s)pack_fstring(self, n, s)pack_hyper = pack_uhyper(self, x)pack_int(self, x)pack_list(self, list, pack_item)pack_opaque = pack_string(self, s)pack_string(self, s)pack_uhyper(self, x)pack_uint(self, x)reset(self)Data descriptors defined here:
__dict__ โ dictionary for instance variables (if defined)__weakref__ โ list of weak references to the object (if defined)Unpacker(data)
Unpacks various data representations from the given buffer.
Methods defined here:
__init__(self, data) โ Initialize self. See help(type(self)) for accurate signature.done(self)get_buffer(self)get_position(self)reset(self, data)set_position(self, position)unpack_array(self, unpack_item)unpack_bool(self)unpack_bytes = unpack_string(self)unpack_double(self)unpack_enum = unpack_int(self)unpack_farray(self, n, unpack_item)unpack_float(self)unpack_fopaque = unpack_fstring(self, n)unpack_fstring(self, n)unpack_hyper(self)unpack_int(self)unpack_list(self, unpack_item)unpack_opaque = unpack_string(self)unpack_string(self)unpack_uhyper(self)unpack_uint(self)Data descriptors defined here:
__dict__ โ dictionary for instance variables (if defined)__weakref__ โ list of weak references to the object (if defined)__all__ = ['Error', 'Packer', 'Unpacker', 'ConversionError']
/usr/lib/python3.10/xdrlib.py
Generated by phpman v4.9.27 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-07-18 12:15 @216.73.216.114
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)
Enhanced by LLM: deepseek-v4-flash / taotoken.net / www.chedong.com - original format