UnpackInt16() public static method

Unpacks System.Int16 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 UnpackInt16 ( Stream source ) : Int16
source Stream The which contains Message Pack binary stream.
return System.Int16
示例#1
0
        private static void TestInt16(Int16 value)
        {
            var output = new MemoryStream();

            Packer.Create(output).Pack(value);
            Assert.AreEqual(value, Unpacking.UnpackInt16(new MemoryStream(output.ToArray())));
            Assert.AreEqual(value, Unpacking.UnpackInt16(output.ToArray()).Value);
        }