コード例 #1
0
ファイル: Binary.cs プロジェクト: jinyuttt/NsqCli
        /// <summary>
        /// Read reads structured binary data from <paramref name="r"/>.
        /// Bytes read from <paramref name="r"/> are decoded using the
        /// specified byte <paramref name="order"/> and written to successive
        /// fields of the data.
        /// </summary>
        /// <param name="r">The reader.</param>
        /// <param name="order">The byte order.</param>
        public static int ReadInt32(IReader r, IByteOrder order)
        {
            // NOTE: Departing from "binary.Read", don't want to box/unbox for this low-level call

            var buf = new byte[4];

            r.Read(buf);
            return(order.Int32(buf));
        }
コード例 #2
0
ファイル: Binary.cs プロジェクト: yonglehou/NsqSharp
        /// <summary>
        /// Read reads structured binary data from <paramref name="r"/>.
        /// Bytes read from <paramref name="r"/> are decoded using the
        /// specified byte <paramref name="order"/> and written to successive
        /// fields of the data.
        /// </summary>
        /// <param name="r">The reader.</param>
        /// <param name="order">The byte order.</param>
        public static int ReadInt32(IReader r, IByteOrder order)
        {
            // NOTE: Departing from "binary.Read", don't want to box/unbox for this low-level call

            var buf = new byte[4];
            r.Read(buf);
            return order.Int32(buf);
        }