Esempio n. 1
0
        /// <summary>
        /// Parses the byte-array to Int16.
        /// </summary>
        /// <returns>The int16.</returns>
        /// <param name="bytes">Bytes.</param>
        /// <param name="offset">Offset.</param>
        public static short ParseInt16(byte[] bytes, ref int offset)
        {
            var readBytes = 0;
            var newBytes  = new byte[bytes.Length - offset];

            Array.Copy(bytes, offset, newBytes, 0, newBytes.Length);
            var shortResult = VarintBitConverter.ToInt16(newBytes, out readBytes);

            offset += readBytes;

            return(shortResult);
        }
Esempio n. 2
0
 /// <summary>
 /// Parses the byte-array to Int16.
 /// </summary>
 /// <returns>The int16.</returns>
 /// <param name="bytes">Bytes.</param>
 public static short ParseInt16(byte[] bytes)
 {
     return(VarintBitConverter.ToInt16(bytes));
 }
Esempio n. 3
0
        /// <summary>
        /// Parses the stream to Int16.
        /// </summary>
        /// <returns>The int16.</returns>
        /// <param name="stream">Stream.</param>
        public static short ParseInt16(Stream stream)
        {
            var byteArray = ParseStreamToByteArray(stream);

            return(VarintBitConverter.ToInt16(byteArray));
        }