def sequence_number(data: Union[FileIO, BufferedReader]) -> Tuple[int, int, bytearray]:
length_bytes = bytearray(data.read(4))
length = int.from_bytes(length_bytes, "big")
if length != 2:
raise EventLengthError("Sequence Number length was incorrect. It should be 2, but it was {}".format(length))
sequence_num_raw = bytearray(data.read(2))
sequence_num = int.from_bytes(sequence_num_raw, "big")
return length, sequence_num, sequence_num_raw
评论列表
文章目录