示例#1
0
 def serialize(self):
     """
     Return a bytestring containing the appropriate structures of the tag.
     """
     data = self.serialize_data()
     rh = RecordHeader(self.id, len(data)).as_bitstream()
     return rh.serialize() + data
示例#2
0
文件: tags.py 项目: magcius/fusion
 def serialize(self):
     """
     Return a bytestring containing the appropriate structures of the tag.
     """
     data = self.serialize_data()
     rh = RecordHeader(self.id, len(data)).as_bitstream()
     return rh.serialize() + data
示例#3
0
 def from_bitstream(cls, bitstream):
     offset = bitstream.tell() // 8
     recordheader = RecordHeader.from_bitstream(bitstream)
     bits = bitstream.read(BitStream[recordheader.length * 8])
     inst = cls.parse_inner(bits)
     inst.length = recordheader.length
     inst.offset = offset
     return inst
示例#4
0
文件: tags.py 项目: magcius/fusion
 def from_bitstream(cls, bitstream):
     offset = bitstream.tell() // 8
     recordheader = RecordHeader.from_bitstream(bitstream)
     bits = bitstream.read(BitStream[recordheader.length*8])
     inst = cls.parse_inner(bits)
     inst.length = recordheader.length
     inst.offset = offset
     return inst
示例#5
0
 def next_tag_header(self):
     if not self._next_tag_header:
         self._next_tag_header = RecordHeader.from_bitstream(self.bitstream)
     return self._next_tag_header