public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (!arrayEncoding) { ListEncoding.Encode((IList)value, buffer); return; } IList lists = (IList)value; int valueSize = 4 + ListEncoding.GetValueSize(lists); ListEncoding.Encode(lists, 4, valueSize, buffer); }
public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (arrayEncoding) { IList listValue = (IList)value; int size = FixedWidth.UInt + GetValueSize(listValue); ListEncoding.Encode(listValue, FixedWidth.UInt, size, buffer); } else { ListEncoding.Encode((IList)value, buffer); } }
public static void Encode(IList value, ByteBuffer buffer) { if (value == null) { AmqpEncoding.EncodeNull(buffer); return; } if (value.Count == 0) { AmqpBitConverter.WriteUByte(buffer, 69); return; } int valueSize = ListEncoding.GetValueSize(value); int encodeWidthByCountAndSize = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize); AmqpBitConverter.WriteUByte(buffer, (byte)((encodeWidthByCountAndSize == 1 ? 192 : 208))); ListEncoding.Encode(value, encodeWidthByCountAndSize, encodeWidthByCountAndSize + valueSize, buffer); }
public static void Encode(IList value, ByteBuffer buffer) { if (value == null) { AmqpEncoding.EncodeNull(buffer); } else if (value.Count == 0) { AmqpBitConverter.WriteUByte(buffer, (byte)FormatCode.List0); } else { int valueSize = ListEncoding.GetValueSize(value); int width = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize); AmqpBitConverter.WriteUByte(buffer, width == FixedWidth.UByte ? (byte)FormatCode.List8 : (byte)FormatCode.List32); int size = width + valueSize; ListEncoding.Encode(value, width, size, buffer); } }