Write7BitEncodedInt64() public method

public Write7BitEncodedInt64 ( long value ) : void
value long
return void
Exemplo n.º 1
0
 public void Flush()
 {
     tree.Flush();
     RootPosition = writer.Position;
     binaryWriter.Write7BitEncodedInt64(currentId);
     binaryWriter.Write7BitEncodedInt64(tree.RootPosition);
 }
Exemplo n.º 2
0
		public void CanEncodeUsing7BitInt64()
		{
			var buffer = new byte[1024];

			for (long i = 0; i < 64*1024; i++)
			{
				var bw = new BinaryWriterWith7BitEncoding(new MemoryStream(buffer));
				bw.Write7BitEncodedInt64(i);
				var br = new BinaryReaderWith7BitEncoding(new MemoryStream(buffer));
				Assert.Equal(i, br.Read7BitEncodedInt64());
			}
		}
Exemplo 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();
        }