Deserialize() public static method

Deserialize a roaring array from a binary format, as written by the Serialize method.
public static Deserialize ( BinaryReader reader ) : RoaringArray
reader BinaryReader The reader from which to deserialize the roaring array.
return RoaringArray
Example #1
0
        /// <summary>
        /// Read a binary serialization of a roaring bitset, as written by the Serialize method.
        /// </summary>
        /// <param name="stream">The stream to read from.</param>
        /// <returns>The bitset deserialized from the stream.</returns>
        public static RoaringBitset Deserialize(Stream stream)
        {
            RoaringBitset bitset = new RoaringBitset();

            //We don't care about the encoding, but we have to specify something to be able to set the stream as leave open.
            using (BinaryReader reader = new BinaryReader(stream, Encoding.Default, true))
            {
                bitset.containers = RoaringArray.Deserialize(reader);
            }

            return(bitset);
        }