Buffer¶
-
class
websocket.stream.buffer.
Buffer
(limit, loop)[source]¶ -
-
read
(n=-1, chunksize=None)[source]¶ Read data from the buffer. Reads until eof or n bytes.
Parameters: n – The amount of data to read. Returns: A bytearray
with the data
-
read_into
(buffer, n, offset=0)[source]¶ Read data from the buffer into a bytearray. Reads until eof or n bytes.
n must not exceed the buffer limit, or else it will block forever.
Parameters: - buffer – The bytearray to write the data into.
- n – The amount of data to read.
- offset – The index into buffer to write to.
-
read_into_exactly
(buffer, n, offset=0)[source]¶ Read data from the buffer into a bytearray. Reads n bytes or throws an exception if reading eof.
n must not exceed the buffer limit, or else it will block forever.
Parameters: - buffer – The bytearray to write the data into.
- n – The amount of data to read.
-