UnpackInt64() public static method

Unpacks System.Int64 value from the specified Stream.

The processed bytes count can be calculated via P:Stream.Position of source when the P:Stream.CanSeek is true.

When the type of packed value is not known, use UnpackObject(Stream) instead.

/// is null. /// /// The of is false. /// /// is not valid MessagePack stream. /// Note that the state of will be unpredictable espicially it is not seekable. /// /// The unpacked result in the is not compatible to . /// Note that the state of will be unpredictable espicially it is not seekable. ///
public static UnpackInt64 ( Stream source ) : System.Int64
source Stream The which contains Message Pack binary stream.
return System.Int64
Ejemplo n.º 1
0
        public void TestUnpackInt32MinValue_UnpackInt64_ByteArray()
        {
            var buffer = new byte[] { 0xD2, 0x80, 0x00, 0x00, 0x00 };
            var result = Unpacking.UnpackInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(-2147483648));
        }
Ejemplo n.º 2
0
        private static void TestInt64(Int64 value)
        {
            var output = new MemoryStream();

            Packer.Create(output).Pack(value);
            Assert.AreEqual(value, Unpacking.UnpackInt64(new MemoryStream(output.ToArray())));
            Assert.AreEqual(value, Unpacking.UnpackInt64(output.ToArray()).Value);
        }
Ejemplo n.º 3
0
        public void TestUnpackInt32MinValueMinusOne_UnpackInt64_ByteArray()
        {
            var buffer = new byte[] { 0xD3, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F, 0xFF, 0xFF, 0xFF };
            var result = Unpacking.UnpackInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(-2147483649));
        }
Ejemplo n.º 4
0
        public void TestUnpackInt64MinValue_UnpackInt64_ByteArray()
        {
            var buffer = new byte[] { 0xD3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
            var result = Unpacking.UnpackInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(-9223372036854775808));
        }
Ejemplo n.º 5
0
        public void TestUnpackNegativeFixNumMinValue_UnpackInt64_ByteArray()
        {
            var buffer = new byte[] { 0xE0 };
            var result = Unpacking.UnpackInt64(buffer);

            Assert.That(result.ReadCount, Is.EqualTo(buffer.Length));
            Assert.That(result.Value, Is.EqualTo(-32));
        }
Ejemplo n.º 6
0
 public void TestUnpackInt32MinValue_UnpackInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xD2, 0x80, 0x00, 0x00, 0x00 }))
     {
         var result = Unpacking.UnpackInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(-2147483648));
     }
 }
Ejemplo n.º 7
0
 public void TestUnpackInt64MinValue_UnpackInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xD3, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }))
     {
         var result = Unpacking.UnpackInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(-9223372036854775808));
     }
 }
Ejemplo n.º 8
0
 public void TestUnpackMinusOne_UnpackInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xFF }))
     {
         var result = Unpacking.UnpackInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(-1));
     }
 }
Ejemplo n.º 9
0
 public void TestUnpackNegativeFixNumMinValue_UnpackInt64_Stream()
 {
     using (var buffer = new MemoryStream(new byte[] { 0xE0 }))
     {
         var result = Unpacking.UnpackInt64(buffer);
         Assert.That(buffer.Position, Is.EqualTo(buffer.Length));
         Assert.That(result, Is.EqualTo(-32));
     }
 }