Amqp.Types.Encoder.WriteUInt C# (CSharp) Method

WriteUInt() public static method

Writes an unsigned 32-bit integer value to a buffer.
public static WriteUInt ( System.ByteBuffer buffer, uint value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value uint The unsigned 32-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void
        public static void WriteUInt(ByteBuffer buffer, uint value, bool smallEncoding)
        {
            if (!smallEncoding || value > byte.MaxValue)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.UInt);
                AmqpBitConverter.WriteUInt(buffer, value);
            }
            else if (value == 0)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.UInt0);
            }
            else if (value <= byte.MaxValue)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.SmallUInt);
                AmqpBitConverter.WriteUByte(buffer, (byte)value);
            }
        }