@@ -328,59 +328,6 @@ I/O Base Classes
328328 ``len(b) ``, since if the write fails, an :exc: `IOError ` will be raised).
329329
330330
331- Raw File I/O
332- ------------
333-
334- .. class :: FileIO(name[, mode])
335-
336- :class: `FileIO ` represents a file containing bytes data. It implements
337- the :class: `RawIOBase ` interface (and therefore the :class: `IOBase `
338- interface, too).
339-
340- The *mode * can be ``'r' ``, ``'w' `` or ``'a' `` for reading (default), writing,
341- or appending. The file will be created if it doesn't exist when opened for
342- writing or appending; it will be truncated when opened for writing. Add a
343- ``'+' `` to the mode to allow simultaneous reading and writing.
344-
345- In addition to the attributes and methods from :class: `IOBase ` and
346- :class: `RawIOBase `, :class: `FileIO ` provides the following data
347- attributes and methods:
348-
349- .. attribute :: mode
350-
351- The mode as given in the constructor.
352-
353- .. attribute :: name
354-
355- The file name. This is the file descriptor of the file when no name is
356- given in the constructor.
357-
358- .. method :: read([n])
359-
360- Read and return at most *n * bytes. Only one system call is made, so it is
361- possible that less data than was requested is returned. Use :func: `len `
362- on the returned bytes object to see how many bytes were actually returned.
363- (In non-blocking mode, ``None `` is returned when no data is available.)
364-
365- .. method :: readall()
366-
367- Read and return the entire file's contents in a single bytes object. As
368- much as immediately available is returned in non-blocking mode. If the
369- EOF has been reached, ``b'' `` is returned.
370-
371- .. method :: write(b)
372-
373- Write the bytes or bytearray object, *b *, to the file, and return
374- the number actually written. Only one system call is made, so it
375- is possible that only some of the data is written.
376-
377- Note that the inherited ``readinto() `` method should not be used on
378- :class: `FileIO ` objects.
379-
380-
381- Buffered Streams
382- ----------------
383-
384331.. class :: BufferedIOBase
385332
386333 Base class for streams that support buffering. It inherits :class: `IOBase `.
@@ -438,6 +385,59 @@ Buffered Streams
438385 underlying raw stream cannot accept more data at the moment.
439386
440387
388+ Raw File I/O
389+ ------------
390+
391+ .. class :: FileIO(name[, mode])
392+
393+ :class: `FileIO ` represents a file containing bytes data. It implements
394+ the :class: `RawIOBase ` interface (and therefore the :class: `IOBase `
395+ interface, too).
396+
397+ The *mode * can be ``'r' ``, ``'w' `` or ``'a' `` for reading (default), writing,
398+ or appending. The file will be created if it doesn't exist when opened for
399+ writing or appending; it will be truncated when opened for writing. Add a
400+ ``'+' `` to the mode to allow simultaneous reading and writing.
401+
402+ In addition to the attributes and methods from :class: `IOBase ` and
403+ :class: `RawIOBase `, :class: `FileIO ` provides the following data
404+ attributes and methods:
405+
406+ .. attribute :: mode
407+
408+ The mode as given in the constructor.
409+
410+ .. attribute :: name
411+
412+ The file name. This is the file descriptor of the file when no name is
413+ given in the constructor.
414+
415+ .. method :: read([n])
416+
417+ Read and return at most *n * bytes. Only one system call is made, so it is
418+ possible that less data than was requested is returned. Use :func: `len `
419+ on the returned bytes object to see how many bytes were actually returned.
420+ (In non-blocking mode, ``None `` is returned when no data is available.)
421+
422+ .. method :: readall()
423+
424+ Read and return the entire file's contents in a single bytes object. As
425+ much as immediately available is returned in non-blocking mode. If the
426+ EOF has been reached, ``b'' `` is returned.
427+
428+ .. method :: write(b)
429+
430+ Write the bytes or bytearray object, *b *, to the file, and return
431+ the number actually written. Only one system call is made, so it
432+ is possible that only some of the data is written.
433+
434+ Note that the inherited ``readinto() `` method should not be used on
435+ :class: `FileIO ` objects.
436+
437+
438+ Buffered Streams
439+ ----------------
440+
441441.. class :: BytesIO([initial_bytes])
442442
443443 A stream implementation using an in-memory bytes buffer. It inherits
0 commit comments