- class b2sdk.stream.chained.ChainedStream(stream_openers)[source]
Chains multiple streams in single stream, sort of what
itertools.chaindoes for iterators.
Cleans up buffers of underlying streams when closed.
Can be seeked to beginning (when retrying upload, for example). Closes underlying streams as soon as they reaches EOF, but clears their buffers when the chained stream is closed for underlying streams that follow
b2sdk.v2.StreamOpenercleanup interface, for example
stream_openeres (list) – list of callables that return opened streams
- property stream
Return currently processed stream.
Return whether object supports random access.
If False, seek(), tell() and truncate() will raise OSError. This method may need to do a test seek().
- seek(pos, whence=0)[source]
Resets stream to the beginning.
Return whether object was opened for reading.
If False, read() will raise OSError.
Read at most size bytes from underlying streams, or all available data, if size is None or negative. Open the streams only when their data is needed, and possibly leave them open and part-way read for further reading - by subsequent calls to this method.
size (int,None) – number of bytes to read. If omitted,
None, or negative data is read and returned until EOF from final stream is reached
data read from the stream
- class b2sdk.stream.chained.StreamOpener[source]
Abstract class to define stream opener with cleanup.