Reader

Attributes
Methods
class zcached.Reader(payload)[source]

Bases: object

Implementation of the reader interface which helps reading data from raw bytes.

Parameters:

payload (bytes) – Payload to read.

buffer

Provided payload.

position

Current reader position.

read(size=None)[source]

Method to read bytes starting at current position.

Parameters:

size (int | None) – Number of bytes to read.

Return type:

bytes

read_until(element)[source]

Method to read bytes from the buffer until the specified element is encountered.

Parameters:

element (bytes) – The byte sequence indicating the end of reading.

Raises:

RuntimeError – There is no specific item in the buffer starting from the current position.

Return type:

bytes

Notes

This method reads bytes from the buffer until the specified element is encountered. It starts reading from the current position in the buffer.