summaryrefslogtreecommitdiffstats
path: root/Doc/library/io.rst
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2014-06-22 21:17:44 (GMT)
committerBenjamin Peterson <benjamin@python.org>2014-06-22 21:17:44 (GMT)
commita96fea03e889b3ec66c91093b8a2cfceb11e2d28 (patch)
treec75453a117a0923c5fe4b1fffa3e4b48f08dafd4 /Doc/library/io.rst
parent77143dbaee8aa15c2f3556438babd0adfbe0dc0f (diff)
downloadcpython-a96fea03e889b3ec66c91093b8a2cfceb11e2d28.zip
cpython-a96fea03e889b3ec66c91093b8a2cfceb11e2d28.tar.gz
cpython-a96fea03e889b3ec66c91093b8a2cfceb11e2d28.tar.bz2
add BufferedIOBase.readinto1 (closes #20578)
Patch by Nikolaus Rath.
Diffstat (limited to 'Doc/library/io.rst')
-rw-r--r--Doc/library/io.rst26
1 files changed, 22 insertions, 4 deletions
diff --git a/Doc/library/io.rst b/Doc/library/io.rst
index 0c7d3c7..2fff23d 100644
--- a/Doc/library/io.rst
+++ b/Doc/library/io.rst
@@ -465,10 +465,11 @@ I/O Base Classes
.. method:: read1(size=-1)
- Read and return up to *size* bytes, with at most one call to the underlying
- raw stream's :meth:`~RawIOBase.read` method. This can be useful if you
- are implementing your own buffering on top of a :class:`BufferedIOBase`
- object.
+ Read and return up to *size* bytes, with at most one call to the
+ underlying raw stream's :meth:`~RawIOBase.read` (or
+ :meth:`~RawIOBase.readinto`) method. This can be useful if you
+ are implementing your own buffering on top of a
+ :class:`BufferedIOBase` object.
.. method:: readinto(b)
@@ -481,6 +482,18 @@ I/O Base Classes
A :exc:`BlockingIOError` is raised if the underlying raw stream is in
non blocking-mode, and has no data available at the moment.
+ .. method:: readinto1(b)
+
+ Read up to ``len(b)`` bytes into bytearray *b*, ,using at most
+ one call to the underlying raw stream's :meth:`~RawIOBase.read`
+ (or :meth:`~RawIOBase.readinto`) method. Return the number of
+ bytes read.
+
+ A :exc:`BlockingIOError` is raised if the underlying raw stream is in
+ non blocking-mode, and has no data available at the moment.
+
+ .. versionadded:: 3.5
+
.. method:: write(b)
Write the given :class:`bytes` or :class:`bytearray` object, *b* and
@@ -596,6 +609,11 @@ than raw I/O does.
In :class:`BytesIO`, this is the same as :meth:`read`.
+ .. method:: readinto1()
+
+ In :class:`BytesIO`, this is the same as :meth:`readinto`.
+
+ .. versionadded:: 3.5
.. class:: BufferedReader(raw, buffer_size=DEFAULT_BUFFER_SIZE)