예제 #1
0
 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
예제 #2
0
 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
예제 #3
0
 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
예제 #4
0
    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
예제 #5
0
 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
예제 #6
0
 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
예제 #7
0
 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
예제 #8
0
 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
예제 #9
0
 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
예제 #10
0
    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)
예제 #11
0
 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
예제 #12
0
 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
예제 #13
0
 def serialize(self):
     sb = StringBuffer(8)
     sb.pack('<Q', self.dim_size)
     sb.seek(0)
     return sb
예제 #14
0
 def serialize(self):
     sb = StringBuffer(8)
     sb.pack('<Q', self.dim_size)
     sb.seek(0)
     return sb