Наследование: EncodingBase
Пример #1
0
 public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (arrayEncoding)
     {
         return(FixedWidth.UInt + FixedWidth.UInt + GetValueSize((AmqpMap)value));
     }
     else
     {
         return(MapEncoding.GetEncodeSize((AmqpMap)value));
     }
 }
Пример #2
0
        public static int GetEncodeSize(AmqpMap value)
        {
            if (value == null)
            {
                return(FixedWidth.NullEncoded);
            }

            int valueSize = GetValueSize(value);

            return(FixedWidth.FormatCode + MapEncoding.GetEncodeWidth(value, valueSize) * 2 + valueSize);
        }
Пример #3
0
 public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer)
 {
     if (arrayEncoding)
     {
         AmqpMap mapValue = (AmqpMap)value;
         int     size     = FixedWidth.UInt + mapValue.ValueSize;
         MapEncoding.Encode(mapValue, FixedWidth.UInt, size, buffer);
     }
     else
     {
         MapEncoding.Encode((AmqpMap)value, buffer);
     }
 }
Пример #4
0
        public static void Encode(AmqpMap value, ByteBuffer buffer)
        {
            if (value == null)
            {
                AmqpEncoding.EncodeNull(buffer);
            }
            else
            {
                int encodeWidth = MapEncoding.GetEncodeWidth(value);
                AmqpBitConverter.WriteUByte(buffer, encodeWidth == FixedWidth.UByte ? FormatCode.Map8 : FormatCode.Map32);

                int size = encodeWidth + value.ValueSize;
                MapEncoding.Encode(value, encodeWidth, size, buffer);
            }
        }
Пример #5
0
        public static AmqpMap Decode(ByteBuffer buffer, FormatCode formatCode)
        {
            if (formatCode == 0 && (formatCode = AmqpEncoding.ReadFormatCode(buffer)) == FormatCode.Null)
            {
                return(null);
            }

            int size;
            int count;

            AmqpEncoding.ReadSizeAndCount(buffer, formatCode, FormatCode.Map8, FormatCode.Map32, out size, out count);
            AmqpMap map = new AmqpMap();

            MapEncoding.ReadMapValue(buffer, map, size, count);
            return(map);
        }
Пример #6
0
 public static int GetEncodeSize(AmqpMap value)
 {
     return(value == null ?
            FixedWidth.NullEncoded :
            FixedWidth.FormatCode + (MapEncoding.GetEncodeWidth(value) * 2) + value.ValueSize);
 }
Пример #7
0
 public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode)
 {
     return(MapEncoding.Decode(buffer, formatCode));
 }