CBFSStorageStream Type
Syntax
cbfsstorage.CBFSStorageStream
Remarks
The CBFSStorageStream type is returned by some of the CBDrive class's methods. All stream types in CBFS Storage share a common API, inherited from Python's io.RawIOBase class, documented below.
Note that, for brevity, many of the members offered by io.RawIOBase are not documented here; please refer to the Python documentation for more information.
Properties | |
length |
Gets the length of the stream, in bytes.
length |
readable |
Whether the stream supports reading.
readable() |
seekable |
Whether the stream supports seeking.
seekable() |
tell |
Gets the current position within the stream.
tell() |
writable |
Whether the stream supports writing.
writeable() |
Methods | |
close |
Flushes and closes the stream. Has no effect if the stream is already closed.
close() |
flush |
Forces all data held by the stream's buffers to be written out to storage.
flush() |
read |
Reads a specified number of bytes from the stream and returns them, advancing the current position within the stream by the number of bytes read.
read(n=-1) Up to n bytes will be read from the stream and returned. If n is unspecified or -1, all bytes are read. Fewer than n bytes may be returned if fewer than n bytes are read. |
readall |
Reads and returns all bytes available in the stream from the current position onwards.
readall() |
readinto |
Reads a sequence of bytes from the stream and advances the current position within the stream by the number of bytes read.
readinto(b) Up to len(b) bytes are read into b, and the number of bytes read is returned. The object b should be a pre-allocated, writable array of bytes, either bytearray or a writable memoryview. |
seek |
Sets the current position within the stream based on a particular point of origin.
seek(offset, whence=SEEK_SET) offset specifies the offset in the stream to seek to, relative to whence, which must be either SEEK_SET, SEEK_CUR, or SEEK_END (or a corresponding integer value) as described by the io.IOBase.seek documentation. Returns the new position within the stream. |
truncate |
Sets the length of the current stream.
truncate(size=None) Resizes the current stream to size bytes (or to the current position if size is None). Returns the new size of the stream. |
write |
Writes a sequence of bytes to the stream and advances the current position within the stream by the number of bytes written.
write(b) The bytes in b are written to the stream, and the number of bytes written in returned. The object b should be an array of bytes, either bytes, bytearray, or memoryview. |