it is important to emphasize that fileio objects are extremely low-levelproviding rather thin layer over operating system calls such as read(and write(specificallyusers of this object will need to diligently check return codes as there is no guarantee that the read(or write(operations will read or write all of the requested data the fcntl module can be used to change low-level aspects of files such as file lockingblocking behaviorand so forth fileio objects should not be used for line-oriented data such as text although methods such as readline(and readlines(are definedthese come from the iobase base class where they are both implemented entirely in python and work by issuing read(operations for single byte at time needless to saythe resulting performance is horrible for exampleusing readline(on fileio object is more than times slower than using readline(on standard file object created by the open(function in python buffered binary / the buffered / layer contains collection of file objects that read and write raw binary databut with in-memory buffering as inputthese objects all require file object that implements raw / such as the fileio object in the previous section all of the classes in this section inherit from bufferediobase bufferedreader(raw [buffer_size] class for buffered binary reading on raw file specified in raw buffer_size specifies the buffer size to use in bytes if omittedthe value of default_buffer_size is used ( , bytes as of this writingan instance of bufferedreader supports all of the operations provided on iobase in addition to these operationsmethod description peek([ ]returns at most bytes of data from the / buffer without moving the file pointer if is omitteda single byte is returned if necessarya read operation will be issued to fill the buffer if it is currently empty this operation never returns more bytes than the current buffer sizeso the result may be smaller than the requested number of bytes in reads bytes and returns as byte string if is omittedall available data (up to eofis read and returned if the underlying file is non-blockingany available data is read and returned if non-blocking file is read and no data is availablea blockingioerror exception is raised reads up to bytes and returns as byte string using single system call if any data is already loaded in the bufferit is simply returned otherwisea single read(is made on the raw file to return data unlike read()this operation may return less data than requested even if the underlying file is not at eof reads len(bbytes of data from the file into an existing bytearray object the actual number of bytes read is returned if the underlying file is in non-blocking modea blockingioerror exception is raised if no data is available read([ ] read ([ ] readinto(bf lib fl ff