Skip to content

Commit b6c7beb

Browse files
committed
move BufferedIOBase into the base class section
1 parent 943a6dd commit b6c7beb

1 file changed

Lines changed: 53 additions & 53 deletions

File tree

Doc/library/io.rst

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -329,59 +329,6 @@ I/O Base Classes
329329
``len(b)``, since if the write fails, an :exc:`IOError` will be raised).
330330

331331

332-
Raw File I/O
333-
------------
334-
335-
.. class:: FileIO(name[, mode])
336-
337-
:class:`FileIO` represents a file containing bytes data. It implements
338-
the :class:`RawIOBase` interface (and therefore the :class:`IOBase`
339-
interface, too).
340-
341-
The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing,
342-
or appending. The file will be created if it doesn't exist when opened for
343-
writing or appending; it will be truncated when opened for writing. Add a
344-
``'+'`` to the mode to allow simultaneous reading and writing.
345-
346-
In addition to the attributes and methods from :class:`IOBase` and
347-
:class:`RawIOBase`, :class:`FileIO` provides the following data
348-
attributes and methods:
349-
350-
.. attribute:: mode
351-
352-
The mode as given in the constructor.
353-
354-
.. attribute:: name
355-
356-
The file name. This is the file descriptor of the file when no name is
357-
given in the constructor.
358-
359-
.. method:: read([n])
360-
361-
Read and return at most *n* bytes. Only one system call is made, so it is
362-
possible that less data than was requested is returned. Use :func:`len`
363-
on the returned bytes object to see how many bytes were actually returned.
364-
(In non-blocking mode, ``None`` is returned when no data is available.)
365-
366-
.. method:: readall()
367-
368-
Read and return the entire file's contents in a single bytes object. As
369-
much as immediately available is returned in non-blocking mode. If the
370-
EOF has been reached, ``b''`` is returned.
371-
372-
.. method:: write(b)
373-
374-
Write the bytes or bytearray object, *b*, to the file, and return
375-
the number actually written. Only one system call is made, so it
376-
is possible that only some of the data is written.
377-
378-
Note that the inherited ``readinto()`` method should not be used on
379-
:class:`FileIO` objects.
380-
381-
382-
Buffered Streams
383-
----------------
384-
385332
.. class:: BufferedIOBase
386333

387334
Base class for streams that support buffering. It inherits :class:`IOBase`.
@@ -439,6 +386,59 @@ Buffered Streams
439386
underlying raw stream cannot accept more data at the moment.
440387

441388

389+
Raw File I/O
390+
------------
391+
392+
.. class:: FileIO(name[, mode])
393+
394+
:class:`FileIO` represents a file containing bytes data. It implements
395+
the :class:`RawIOBase` interface (and therefore the :class:`IOBase`
396+
interface, too).
397+
398+
The *mode* can be ``'r'``, ``'w'`` or ``'a'`` for reading (default), writing,
399+
or appending. The file will be created if it doesn't exist when opened for
400+
writing or appending; it will be truncated when opened for writing. Add a
401+
``'+'`` to the mode to allow simultaneous reading and writing.
402+
403+
In addition to the attributes and methods from :class:`IOBase` and
404+
:class:`RawIOBase`, :class:`FileIO` provides the following data
405+
attributes and methods:
406+
407+
.. attribute:: mode
408+
409+
The mode as given in the constructor.
410+
411+
.. attribute:: name
412+
413+
The file name. This is the file descriptor of the file when no name is
414+
given in the constructor.
415+
416+
.. method:: read([n])
417+
418+
Read and return at most *n* bytes. Only one system call is made, so it is
419+
possible that less data than was requested is returned. Use :func:`len`
420+
on the returned bytes object to see how many bytes were actually returned.
421+
(In non-blocking mode, ``None`` is returned when no data is available.)
422+
423+
.. method:: readall()
424+
425+
Read and return the entire file's contents in a single bytes object. As
426+
much as immediately available is returned in non-blocking mode. If the
427+
EOF has been reached, ``b''`` is returned.
428+
429+
.. method:: write(b)
430+
431+
Write the bytes or bytearray object, *b*, to the file, and return
432+
the number actually written. Only one system call is made, so it
433+
is possible that only some of the data is written.
434+
435+
Note that the inherited ``readinto()`` method should not be used on
436+
:class:`FileIO` objects.
437+
438+
439+
Buffered Streams
440+
----------------
441+
442442
.. class:: BytesIO([initial_bytes])
443443

444444
A stream implementation using an in-memory bytes buffer. It inherits

0 commit comments

Comments
 (0)