def serialize(self): sb = StringBuffer(16 + self.total_size) sb.pack('<BBHIQ', self.mfs_type, 0, 0, self.entry_no, self.total_size) for symbol in self.symbols: sb.write(symbol.serialize()) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(16 + self.total_size) sb.pack('<BBBBIQ', self.mfs_type, self.ver, self.dims, self.flags, 0, self.total_size) for ds in self.dataspaces: sb.write(ds.serialize()) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(24) sb.pack('<BBH', self.mfs_type, self.mode, self.flags) sb.write(self.sha) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(16 + self.total_size) sb.pack('<BBHHHQ', self.mfs_type, self.ver, self.name_size, self.datatype_size, self.dataspace_size, self.total_size) if self.attr is not None: sb.write(self.attr.serialize()) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(8 + self.symbol_length) sb.pack('<HHI', self.idx, 0, max(len(self.symbol) + 1, self.symbol_length)) # Account for null-terminator sb.write(self.symbol) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(16 + self.total_size) sb.pack('<BBH', self.mfs_type, self.version, self.children) sb.write(self.signature) sb.pack('<Q', self.total_size) for o in self.objects: sb.write(o.serialize()) return sb
def test_read_uint(self): sb = StringBuffer(16) sb.pack('<H', 16) sb.seek(0) i = sb.read_uint(2) self.assertEquals(i, 16) self.assertEquals(sb.offset(), 2) sb.pack('<Q', 1024) sb.seek(2) i = sb.read_uint(8) self.assertEquals(1024, i)
def serialize(self): sb = StringBuffer(8 + self.symbol_length) sb.pack('<HHI', self.idx, 0, max(len(self.symbol)+1, self.symbol_length)) # Account for null-terminator sb.write(self.symbol) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(16) sb.pack('<BBHIQ', self.mfs_type, self.datatype, self.flags, self.size, self.total_size) sb.seek(0) return sb
def serialize(self): sb = StringBuffer(8) sb.pack('<Q', self.dim_size) sb.seek(0) return sb