607
607
if the buffer needs to be written out but the raw stream blocks.
610
.. class:: BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE)
612
A buffered interface to random access streams. It inherits
613
:class:`BufferedReader` and :class:`BufferedWriter`, and further supports
614
:meth:`seek` and :meth:`tell` functionality.
616
The constructor creates a reader and writer for a seekable raw stream, given
617
in the first argument. If the *buffer_size* is omitted it defaults to
618
:data:`DEFAULT_BUFFER_SIZE`.
620
A third argument, *max_buffer_size*, is supported, but unused and deprecated.
622
:class:`BufferedRandom` is capable of anything :class:`BufferedReader` or
623
:class:`BufferedWriter` can do.
610
626
.. class:: BufferedRWPair(reader, writer, buffer_size=DEFAULT_BUFFER_SIZE)
612
A buffered I/O object giving a combined, higher-level access to two
613
sequential :class:`RawIOBase` objects: one readable, the other writeable.
614
It is useful for pairs of unidirectional communication channels
615
(pipes, for instance). It inherits :class:`BufferedIOBase`.
628
A buffered I/O object combining two unidirectional :class:`RawIOBase`
629
objects -- one readable, the other writeable -- into a single bidirectional
630
endpoint. It inherits :class:`BufferedIOBase`.
617
632
*reader* and *writer* are :class:`RawIOBase` objects that are readable and
618
633
writeable respectively. If the *buffer_size* is omitted it defaults to
625
640
except for :meth:`~BufferedIOBase.detach`, which raises
626
641
:exc:`UnsupportedOperation`.
629
.. class:: BufferedRandom(raw, buffer_size=DEFAULT_BUFFER_SIZE)
631
A buffered interface to random access streams. It inherits
632
:class:`BufferedReader` and :class:`BufferedWriter`, and further supports
633
:meth:`seek` and :meth:`tell` functionality.
635
The constructor creates a reader and writer for a seekable raw stream, given
636
in the first argument. If the *buffer_size* is omitted it defaults to
637
:data:`DEFAULT_BUFFER_SIZE`.
639
A third argument, *max_buffer_size*, is supported, but unused and deprecated.
641
:class:`BufferedRandom` is capable of anything :class:`BufferedReader` or
642
:class:`BufferedWriter` can do.
644
:class:`BufferedRWPair` does not attempt to synchronize accesses to
645
its underlying raw streams. You should not pass it the same object
646
as reader and writer; use :class:`BufferedRandom` instead.