Beispiel #1
0
        /// <summary>
        /// Parses the byte-array to Int64.
        /// </summary>
        /// <returns>The int64.</returns>
        /// <param name="bytes">Bytes.</param>
        /// <param name="offset">Offset.</param>
        public static long ParseInt64(byte[] bytes, ref int offset)
        {
            var readBytes = 0;
            var newBytes  = new byte[bytes.Length - offset];

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

            offset += readBytes;

            return(longResult);
        }
Beispiel #2
0
 /// <summary>
 /// Parses the byte-array to Int64.
 /// </summary>
 /// <returns>The int64.</returns>
 /// <param name="bytes">Bytes.</param>
 public static long ParseInt64(byte[] bytes)
 {
     return(VarintBitConverter.ToInt64(bytes));
 }
Beispiel #3
0
        /// <summary>
        /// Parses the stream to Int64.
        /// </summary>
        /// <returns>The int64.</returns>
        /// <param name="stream">Stream.</param>
        public static long ParseInt64(Stream stream)
        {
            var byteArray = ParseStreamToByteArray(stream);

            return(VarintBitConverter.ToInt64(byteArray));
        }