Part of bzrlib.smart.protocol View In Hierarchy
Known subclasses: bzrlib.smart.protocol.ChunkedBodyDecoder, bzrlib.smart.protocol.LengthPrefixedBodyDecoder, bzrlib.smart.protocol.ProtocolThreeDecoder
Subclasses should provide a self.state_accept attribute that accepts bytes and, if appropriate, updates self.state_accept to a different function. accept_bytes will call state_accept as often as necessary to make sure the state machine has progressed as far as possible before it returns.
See ProtocolThreeDecoder for an example subclass.
Method | __init__ | Undocumented |
Method | accept_bytes | Decode as much of bytes as possible. |
Method | _get_in_buffer | Undocumented |
Method | _get_in_bytes | Grab X bytes from the input_buffer. |
Method | _set_in_buffer | Undocumented |
Callers should have already checked that self._in_buffer_len is > count. Note, this does not consume the bytes from the buffer. The caller will still need to call _get_in_buffer() and then _set_in_buffer() if they actually need to consume the bytes.
If 'bytes' contains too much data it will be appended to self.unused_data.
finished_reading will be set when no more data is required. Further data will be appended to self.unused_data.