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); }
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); }
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); } 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); } }
static int GetEncodeWidth(AmqpMap value) { return(AmqpEncoding.GetEncodeWidthByCountAndSize(value.Count * 2, value.ValueSize)); }