allow PayloadBuilder to be rewound

This commit is contained in:
2018-06-16 21:41:29 +02:00
parent c47e196312
commit 666e18c57e
+4
View File
@@ -13,6 +13,10 @@ class PayloadBuilder:
""" Get the byte buffer """
return self.buf
def reset(self):
""" Clear the buffer """
self.buf.clear()
def u8(self, num:int):
""" Add a uint8_t """
self.buf.extend((num&0xFF).to_bytes(length=1, byteorder=self.endian, signed=False))