Back to module index
Go to module by name
xdrlib
Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
Classes
BytesIO
Buffered I/O implementation using an in-memory bytes buffer.
close(self, /)
Disable all I/O operations.
detach(self, /)
Disconnect this buffer from its underlying raw stream and return it.
After the raw stream has been detached, the buffer is in an unusable
state.
fileno(self, /)
Returns underlying file descriptor if one exists.
OSError is raised if the IO object does not use a file descriptor.
flush(self, /)
Does nothing.
getbuffer(self, /)
Get a read-write view over the contents of the BytesIO object.
getvalue(self, /)
Retrieve the entire contents of the BytesIO object.
isatty(self, /)
Always returns False.
BytesIO objects are not connected to a TTY-like device.
read(self, size=-1, /)
Read at most size bytes, returned as a bytes object.
If the size argument is negative, read until EOF is reached.
Return an empty bytes object at EOF.
read1(self, size=-1, /)
Read at most size bytes, returned as a bytes object.
If the size argument is negative or omitted, read until EOF is reached.
Return an empty bytes object at EOF.
readable(self, /)
Returns True if the IO object can be read.
readinto(self, buffer, /)
Read bytes into buffer.
Returns number of bytes read (0 for EOF), or None if the object
is set not to block and has no data to read.
readinto1(self, buffer, /)
readline(self, size=-1, /)
Next line from the file, as a bytes object.
Retain newline. A non-negative size argument limits the maximum
number of bytes to return (an incomplete line may be returned then).
Return an empty bytes object at EOF.
readlines(self, size=None, /)
List of bytes objects, each a line from the file.
Call readline() repeatedly and return a list of the lines so read.
The optional size argument, if given, is an approximate bound on the
total number of bytes in the lines returned.
seek(self, pos, whence=0, /)
Change stream position.
Seek to byte offset pos relative to position indicated by whence:
0 Start of stream (the default). pos should be >= 0;
1 Current position - pos may be negative;
2 End of stream - pos usually negative.
Returns the new absolute position.
seekable(self, /)
Returns True if the IO object can be seeked.
tell(self, /)
Current file position, an integer.
truncate(self, size=None, /)
Truncate the file to at most size bytes.
Size defaults to the current file position, as returned by tell().
The current file position is unchanged. Returns the new size.
writable(self, /)
Returns True if the IO object can be written.
write(self, b, /)
Write bytes to file.
Return the number of bytes written.
writelines(self, lines, /)
Write lines to the file.
Note that newlines are not added. lines can be any iterable object
producing bytes-like objects. This is equivalent to calling write() for
each element.
closed = <attribute 'closed' of '_io.BytesIO' objects>
True if the file is closed.
ConversionError
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Error
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
with_traceback(...)
Exception.with_traceback(tb) --
set self.__traceback__ to tb and return self.
args = <attribute 'args' of 'BaseException' objects>
Packer
Pack various data representations into a buffer.
get_buffer(self)
get_buffer(self)
pack_array(self, list, pack_item)
pack_bool(self, x)
pack_string(self, s)
pack_double(self, x)
pack_int(self, x)
pack_farray(self, n, list, pack_item)
pack_float(self, x)
pack_fstring(self, n, s)
pack_fstring(self, n, s)
pack_uhyper(self, x)
pack_int(self, x)
pack_list(self, list, pack_item)
pack_string(self, s)
pack_string(self, s)
pack_uhyper(self, x)
pack_uint(self, x)
reset(self)
Unpacker
Unpacks various data representations from the given buffer.
done(self)
get_buffer(self)
get_position(self)
reset(self, data)
set_position(self, position)
unpack_array(self, unpack_item)
unpack_bool(self)
unpack_string(self)
unpack_double(self)
unpack_int(self)
unpack_farray(self, n, unpack_item)
unpack_float(self)
unpack_fstring(self, n)
unpack_fstring(self, n)
unpack_hyper(self)
unpack_int(self)
unpack_list(self, unpack_item)
unpack_string(self)
unpack_string(self)
unpack_uhyper(self)
unpack_uint(self)
Functions
raise_conversion_error
raise_conversion_error(function)
Wrap any raised struct.errors in a ConversionError.
wraps
wraps(wrapped, assigned=('__module__', '__name__', '__qualname__', '__doc__', '__annotations__'), updated=('__dict__',))
Decorator factory to apply update_wrapper() to a wrapper function
Returns a decorator that invokes update_wrapper() with the decorated
function as the wrapper argument and the arguments to wraps() as the
remaining arguments. Default arguments are as for update_wrapper().
This is a convenience function to simplify applying partial() to
update_wrapper().
Modules
struct