(self)
return string
Return binary string representation
Return binary string representation
Return binary string representation
def encode(self):
        'Return binary string representation'
        string = ""
        for typ,siz in self.order:
            if typ == 0xFFFF:   # end of block
                encoded = None
            else:
                name,decenc = self.format[typ]
                value = self.__dict__[name]
                encoded = decenc[1](value)
                pass
            buf = struct.pack('<H',typ)
            buf += struct.pack('<I',siz)
            if encoded is not None:
                buf += struct.pack('<%ds'%siz,encoded)
            string += buf
            continue
        return string
def encode ( self ) : string = "" for typ , siz in self . order : if typ == 0xFFFF : # end of block encoded = None else : name , decenc = self . format [ typ ] value = self . __dict__ [ name ] encoded = decenc [ 1 ] ( value ) pass buf = struct . pack ( '<H' , typ ) buf += struct . pack ( '<I' , siz ) if encoded is not None : buf += struct . pack ( '<%ds' % siz , encoded ) string += buf continue return string