On this page
io.BufferedIOBase
Prev: io.BlockingIOError | Up: io | Next: io.BufferedRandom
Rel: io.BlockingIOError, io.BufferedRandom, io.BufferedReader, io.BufferedRWPair
Ref: docs.python.org — io.BufferedIOBase
Tags: #public #python3 #stdlib #io
Import
import io
from io import BufferedIOBase
Signature & Overview
io.BufferedIOBase()
Base class for buffered IO objects.
Methods & Attributes
BufferedIOBase.close(self, /)— Flush and close the IO object.BufferedIOBase.detach(self, /)— Disconnect this buffer from its underlying raw stream and return it.BufferedIOBase.fileno(self, /)— Return underlying file descriptor if one exists.BufferedIOBase.flush(self, /)— Flush write buffers, if applicable.BufferedIOBase.isatty(self, /)— Return whether this is an 'interactive' stream.BufferedIOBase.read(self, size=-1, /)— Read and return up to n bytes.BufferedIOBase.read1(self, size=-1, /)— Read and return up to size bytes, with at most one read() call to the underlying raw stream.BufferedIOBase.readable(self, /)— Return whether object was opened for reading.BufferedIOBase.readinto(self, buffer, /)—BufferedIOBase.readintomethod/property.BufferedIOBase.readinto1(self, buffer, /)—BufferedIOBase.readinto1method/property.BufferedIOBase.readline(self, size=-1, /)— Read and return a line from the stream.BufferedIOBase.readlines(self, hint=-1, /)— Return a list of lines from the stream.BufferedIOBase.seek(self, offset, whence=0, /)— Change the stream position to the given byte offset.BufferedIOBase.seekable(self, /)— Return whether object supports random access.BufferedIOBase.tell(self, /)— Return current stream position.BufferedIOBase.truncate(self, size=None, /)— Truncate file to size bytes.BufferedIOBase.writable(self, /)— Return whether object was opened for writing.BufferedIOBase.write(self, b, /)— Write buffer b to the IO stream.BufferedIOBase.writelines(self, lines, /)— Write a list of lines to stream.
Usage
import io
buf = io.BytesIO(b"abc")
assert isinstance(buf, io.BufferedIOBase)
Gotchas
- Abstract base class for buffered binary streams:
BytesIO,BufferedReader,BufferedWriter, andBufferedRandomall inherit fromBufferedIOBase.
REPL Inspect
from io import BufferedIOBase
help(BufferedIOBase)
Linked from
- tuts/python3/stdlib_module/io
- tuts/python3/stdlib_module/io/BlockingIOError
- tuts/python3/stdlib_module/io/BufferedRandom
- tuts/python3/stdlib_module/io/BufferedReader
- tuts/python3/stdlib_module/io/BufferedRWPair
- tuts/python3/stdlib_module/io/BufferedWriter
- tuts/python3/stdlib_module/io/BytesIO
- tuts/python3/stdlib_module/io/FileIO
- tuts/python3/stdlib_module/io/IncrementalNewlineDecoder
- tuts/python3/stdlib_module/io/IOBase
- tuts/python3/stdlib_module/io/open
- tuts/python3/stdlib_module/io/open_code
- tuts/python3/stdlib_module/io/RawIOBase
- tuts/python3/stdlib_module/io/Reader
- tuts/python3/stdlib_module/io/StringIO
- tuts/python3/stdlib_module/io/text_encoding
- tuts/python3/stdlib_module/io/TextIOBase
- tuts/python3/stdlib_module/io/TextIOWrapper
- tuts/python3/stdlib_module/io/UnsupportedOperation
- tuts/python3/stdlib_module/io/Writer
Related notes
- tuts/python3/stdlib_module/io/BlockingIOError Linked here; links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/BufferedRandom Linked here; links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/BufferedReader Linked here; links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/BufferedRWPair Linked here; links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/io/BufferedWriter links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/BytesIO links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/FileIO links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/IncrementalNewlineDecoder links to this page; shared tags: #io, #stdlib
- tuts/python3/stdlib_module/io/IOBase links to this page; shared tags: #io, #stdlib