mvpa2.support.nibabel.afni_niml.BytesIO¶
-
class
mvpa2.support.nibabel.afni_niml.
BytesIO
¶ Create a buffered I/O implementation using an in-memory bytes buffer, ready for reading and writing.
Attributes
closed
True if the file is closed. Methods
close
(() -> None. Disable all I/O operations.)detach
Disconnect this buffer from its underlying raw stream and return it. fileno
Returns underlying file descriptor if one exists. flush
(() -> None. Does nothing.)getvalue
(() -> bytes.)Retrieve the entire contents of the BytesIO object. isatty
(() -> False.)Always returns False since BytesIO objects are not connected to a tty-like device. next
read
(([size]) -> read at most size bytes, ...)If the size argument is negative, read until EOF is reached. read1
((size) -> read at most size bytes, ...)If the size argument is negative or omitted, read until EOF is reached. readable
(...)readinto
(...)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
(...)Retain newline. readlines
(([size]) -> list of strings, ...)Call readline() repeatedly and return a list of the lines so read. seek
((pos[, ...)Seek to byte offset pos relative to position indicated by whence: 0 Start of stream (the default). seekable
(...)tell
(() -> current file position, an integer)truncate
(...)Size defaults to the current file position, as returned by tell(). writable
(...)write
((bytes) -> int. Write bytes to file.)Return the number of bytes written. writelines
(...)Note that newlines are not added. -
close
() → None. Disable all I/O operations.¶
-
closed
¶ True if the file is closed.
-
flush
() → None. Does nothing.¶
-
getvalue
() → bytes.¶ Retrieve the entire contents of the BytesIO object.
-
isatty
() → False.¶ Always returns False since BytesIO objects are not connected to a tty-like device.
-
next
¶
-
read
([size]) → read at most size bytes, returned as a string.¶ If the size argument is negative, read until EOF is reached. Return an empty string at EOF.
-
read1
(size) → read at most size bytes, returned as a string.¶ If the size argument is negative or omitted, read until EOF is reached. Return an empty string at EOF.
-
readable
() → bool. Returns True if the IO object can be read.¶
-
readinto
(b) → int. Read up to len(b) bytes into b.¶ 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]) → next line from the file, as a string.¶ 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 string at EOF.
-
readlines
([size]) → list of strings, 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]) → int. 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
() → bool. Returns True if the IO object can be seeked.¶
-
tell
() → current file position, an integer¶
-
truncate
([size]) → int. 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
() → bool. Returns True if the IO object can be written.¶
-
write
(bytes) → int. Write bytes to file.¶ Return the number of bytes written.
-
writelines
(sequence_of_strings) → None. Write strings to the file.¶ Note that newlines are not added. The sequence can be any iterable object producing strings. This is equivalent to calling write() for each string.
-