public override int GetObjectEncodeSize(object value, bool arrayEncoding) { if (!arrayEncoding) { return(ListEncoding.GetEncodeSize((IList)value)); } return(8 + ListEncoding.GetValueSize((IList)value)); }
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 static int GetEncodeSize(IList value) { if (value == null) { return(1); } if (value.Count == 0) { return(1); } int valueSize = ListEncoding.GetValueSize(value); int encodeWidthByCountAndSize = AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count, valueSize); return(1 + encodeWidthByCountAndSize * 2 + valueSize); }
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); } }
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); } }