map2loop.mapdata.BytesIO#

class map2loop.mapdata.BytesIO(initial_bytes=b'')#

Bases: _BufferedIOBase

Buffered I/O implementation using an in-memory bytes buffer.

__init__(*args, **kwargs)#

Methods

__init__(*args, **kwargs)

close()

Disable all I/O operations.

detach()

Disconnect this buffer from its underlying raw stream and return it.

fileno()

Return underlying file descriptor if one exists.

flush()

Does nothing.

getbuffer()

Get a read-write view over the contents of the BytesIO object.

getvalue()

Retrieve the entire contents of the BytesIO object.

isatty()

Always returns False.

read([size])

Read at most size bytes, returned as a bytes object.

read1([size])

Read at most size bytes, returned as a bytes object.

readable()

Returns True if the IO object can be read.

readinto(buffer, /)

Read bytes into buffer.

readinto1(buffer, /)

readline([size])

Next line from the file, as a bytes object.

readlines([size])

List of bytes objects, each a line from the file.

seek(pos[, whence])

Change stream position.

seekable()

Returns True if the IO object can be seeked.

tell()

Current file position, an integer.

truncate([size])

Truncate the file to at most size bytes.

writable()

Returns True if the IO object can be written.

write(b, /)

Write bytes to file.

writelines(lines, /)

Write lines to the file.

Attributes

closed

True if the file is closed.

close()#

Disable all I/O operations.

closed#

True if the file is closed.

detach()#

Disconnect this buffer from its underlying raw stream and return it.

After the raw stream has been detached, the buffer is in an unusable state.

fileno()#

Return underlying file descriptor if one exists.

Raise OSError if the IO object does not use a file descriptor.

flush()#

Does nothing.

getbuffer()#

Get a read-write view over the contents of the BytesIO object.

getvalue()#

Retrieve the entire contents of the BytesIO object.

isatty()#

Always returns False.

BytesIO objects are not connected to a TTY-like device.

read(size=-1, /)#

Read at most size bytes, returned as a bytes object.

If the size argument is negative, read until EOF is reached. Return an empty bytes object at EOF.

read1(size=-1, /)#

Read at most size bytes, returned as a bytes object.

If the size argument is negative or omitted, read until EOF is reached. Return an empty bytes object at EOF.

readable()#

Returns True if the IO object can be read.

readinto(buffer, /)#

Read bytes into buffer.

Returns number of bytes read (0 for EOF), or None if the object is set not to block and has no data to read.

readline(size=-1, /)#

Next line from the file, as a bytes object.

Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty bytes object at EOF.

readlines(size=None, /)#

List of bytes objects, each a line from the file.

Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.

seek(pos, whence=0, /)#

Change stream position.

Seek to byte offset pos relative to position indicated by whence:

0 Start of stream (the default). pos should be >= 0; 1 Current position - pos may be negative; 2 End of stream - pos usually negative.

Returns the new absolute position.

seekable()#

Returns True if the IO object can be seeked.

tell()#

Current file position, an integer.

truncate(size=None, /)#

Truncate the file to at most size bytes.

Size defaults to the current file position, as returned by tell(). The current file position is unchanged. Returns the new size.

writable()#

Returns True if the IO object can be written.

write(b, /)#

Write bytes to file.

Return the number of bytes written.

writelines(lines, /)#

Write lines to the file.

Note that newlines are not added. lines can be any iterable object producing bytes-like objects. This is equivalent to calling write() for each element.