public void TestSerialization() { using (var rb1 = new RoaringBitmap()) { rb1.AddMany(1, 2, 3, 4, 5, 100, 1000); rb1.Optimize(); var s1 = rb1.Serialize(SerializationFormat.Normal); var s2 = rb1.Serialize(SerializationFormat.Portable); using (var rb2 = RoaringBitmap.Deserialize(s1, SerializationFormat.Normal)) using (var rb3 = RoaringBitmap.Deserialize(s2, SerializationFormat.Portable)) { Assert.True(rb1.Equals(rb2)); Assert.True(rb1.Equals(rb3)); } } }
public CloudBitmapDB(string aPath) { string highPath = $"{aPath}.high.bin"; string lowPath = $"{aPath}.low.bin"; if (File.Exists(highPath)) { high = RoaringBitmap.Deserialize(File.ReadAllBytes(highPath), SerializationFormat.Portable); } else { high = new RoaringBitmap(); } if (File.Exists(lowPath)) { low = RoaringBitmap.Deserialize(File.ReadAllBytes(lowPath), SerializationFormat.Portable); } else { low = new RoaringBitmap(); } }