WriteBitEncodedNullableInt64() public method

public WriteBitEncodedNullableInt64 ( long value ) : void
value long
return void
Esempio n. 1
0
        private long WriteNode(TreeNode arg)
        {
            var position = writer.Position;

            Write(arg.NodeKey);
            binaryWriter.WriteBitEncodedNullableInt64(arg.Left == null ? null : (arg.Left.Position));
            binaryWriter.WriteBitEncodedNullableInt64(arg.Right == null ? null : (arg.Right.Position));
            binaryWriter.WriteBitEncodedNullableInt64(arg.NodeValue);
            return(position);
        }
Esempio n. 2
0
		public void CanEncodeUsing7BitInt64WithNullableInt()
		{
			var buffer = new byte[1024];

			for (long i = 0; i < 64 * 1024; i++)
			{
				var bw = new BinaryWriterWith7BitEncoding(new MemoryStream(buffer));
				bw.WriteBitEncodedNullableInt64(i);
				var br = new BinaryReaderWith7BitEncoding(new MemoryStream(buffer));
				Assert.Equal(i, br.ReadBitEncodedNullableInt64());
			}
		}
Esempio n. 3
0
        public void Flush()
        {
            if (unwritten.Count == 0)
            {
                return;
            }

            var pos = writer.Position;

            binaryWriter.Write7BitEncodedInt(unwritten.Count);
            foreach (var value in unwritten)
            {
                binaryWriter.Write7BitEncodedInt64(value);
            }
            binaryWriter.WriteBitEncodedNullableInt64(current == null ? (long?)null : current.Position);
            current = new ListItem(unwritten.ToArray(), current)
            {
                Position = pos
            };
            unwritten.Clear();
        }