コード例 #1
0
 /// <summary>
 /// The cloneable constructor.
 /// </summary>
 /// <remarks>
 /// This constructor is used for any kind of class cloning.
 /// </remarks>
 /// <param name="order">
 /// The reference of <see cref="IByteOrder"/> to be used to determine
 /// actual byte order.
 /// </param>
 /// <param name="buffer">
 /// The buffer to get all cloneable data from.
 /// </param>
 private BitCharger(IByteOrder order, StringBuilder buffer)
     : base()
 {
     this.helper = order;
     this.buffer = new StringBuilder(buffer.Capacity);
     this.buffer.Append(buffer); // Internally, ToString() is called.
 }
コード例 #2
0
        /// <summary>
        /// The internally visible constructor.
        /// </summary>
        /// <remarks>
        /// Actually, this constructor is only for testing purposes.
        /// </remarks>
        /// <param name="order">
        /// An instance of <see cref="IByteOrder"/> to be used to determine
        /// actual byte order.
        /// </param>
        /// <exception cref="ArgumentNullException">
        /// The exception is thrown if parameter <paramref name="order"/>
        /// is null.
        /// </exception>
        internal BitCharger(IByteOrder order)
            : base()
        {
            this.helper = order ?? throw new ArgumentNullException(nameof(order));

            this.buffer = new StringBuilder(BitCharger.DefaultCapacity);
        }
コード例 #3
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));
        }
コード例 #4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="byteOrder"></param>
        /// <returns></returns>
        public ByteBuffer Order(IByteOrder byteOrder)
        {
            if (byteOrder == null)
            {
                throw new ArgumentNullException("byteOrder");
            }

            order = byteOrder;
            return(this);
        }
コード例 #5
0
ファイル: ByteBuffer.cs プロジェクト: usausa/Smart-Net-CE
        /// <summary>
        ///
        /// </summary>
        /// <param name="byteOrder"></param>
        /// <returns></returns>
        public ByteBuffer Order(IByteOrder byteOrder)
        {
            if (byteOrder == null)
            {
                throw new ArgumentNullException("byteOrder");
            }

            order = byteOrder;
            return this;
        }
コード例 #6
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);
        }