GetEncodeWidthByCountAndSize() public static method

public static GetEncodeWidthByCountAndSize ( int count, int valueSize ) : int
count int
valueSize int
return int
示例#1
0
        internal static int GetEncodeSize(IList array, int count, Type itemType, bool arrayEncoding, out int width)
        {
            int size = FixedWidth.FormatCode + ArrayEncoding.GetValueSize(array, count, itemType);

            width = arrayEncoding ? FixedWidth.UInt : AmqpEncoding.GetEncodeWidthByCountAndSize(count, size);
            size += FixedWidth.FormatCode + width + width;
            return(size);
        }
示例#2
0
        static int GetEncodeSize(Array array, bool arrayEncoding, out int width)
        {
            int size = FixedWidth.FormatCode + ArrayEncoding.GetValueSize(array, null);

            width = arrayEncoding ? FixedWidth.UInt : AmqpEncoding.GetEncodeWidthByCountAndSize(array.Length, size);
            size += FixedWidth.FormatCode + width + width;
            return(size);
        }
示例#3
0
 public static int GetEncodeSize(IList value)
 {
     if (value == null)
     {
         return(FixedWidth.NullEncoded);
     }
     else if (value.Count == 0)
     {
         return(FixedWidth.FormatCode);
     }
     else
     {
         int valueSize = ListEncoding.GetValueSize(value);
         int width     = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize);
         return(FixedWidth.FormatCode + (width * 2) + valueSize);
     }
 }
示例#4
0
        public static void Encode(IList value, ByteBuffer buffer)
        {
            if (value == null)
            {
                AmqpEncoding.EncodeNull(buffer);
            }
            else if (value.Count == 0)
            {
                AmqpBitConverter.WriteUByte(buffer, FormatCode.List0);
            }
            else
            {
                int valueSize = ListEncoding.GetValueSize(value);
                int width     = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize);
                AmqpBitConverter.WriteUByte(buffer, width == FixedWidth.UByte ? FormatCode.List8 : FormatCode.List32);

                int size = width + valueSize;
                ListEncoding.Encode(value, width, size, buffer);
            }
        }
示例#5
0
 static int GetEncodeWidth(AmqpMap value)
 {
     return(AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count * 2, value.ValueSize));
 }