@staticmethod def from_bin(dataB): reader=io.BytesIO(dataB) length1= reader.read(4) length2=reader.read(4) length3=reader.read(4) macs=reader.read(length1) uid=reader.read(length2) signature=reader.read(length3) reader.close() message=Message(macs,uid,signature) return message
References :
https://docs.python.org/3/library/io.html#io.BytesIO http://chimera.labs.oreilly.com/books/1230000000393/ch05.html#_solution_78
https://docs.python.org/2/library/io.html