public static WriteUuid ( System.ByteBuffer buffer, System.Guid data ) : void | ||
buffer | System.ByteBuffer | |
data | System.Guid | |
리턴 | void |
public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (arrayEncoding) { AmqpBitConverter.WriteUuid(buffer, (Guid)value); } else { UuidEncoding.Encode((Guid)value, buffer); } }
public static void Encode(Guid?value, ByteBuffer buffer) { if (value.HasValue) { AmqpBitConverter.WriteUByte(buffer, FormatCode.Uuid); AmqpBitConverter.WriteUuid(buffer, value.Value); } else { AmqpEncoding.EncodeNull(buffer); } }
internal static void EncodeValue(IList value, int count, Type itemType, ByteBuffer buffer) { if (count == 0) { return; } EncodingBase encoding = AmqpEncoding.GetEncoding(itemType); switch (encoding.FormatCode) { case FormatCode.UInt: EncodeArray <uint>(buffer, (IList <uint>)value, count, FormatCode.UInt, (b, v, i) => AmqpBitConverter.WriteUInt(b, v)); return; case FormatCode.Int: buffer.Validate(true, FixedWidth.Int * count); EncodeArray <int>(buffer, (IList <int>)value, count, FormatCode.Int, (b, v, i) => { AmqpBitConverter.WriteInt(b.Buffer, b.WritePos + i * FixedWidth.Int, v); }); buffer.Append(FixedWidth.Int * count); return; case FormatCode.ULong: EncodeArray <ulong>(buffer, (IList <ulong>)value, count, FormatCode.ULong, (b, v, i) => AmqpBitConverter.WriteULong(b, v)); return; case FormatCode.Long: EncodeArray <long>(buffer, (IList <long>)value, count, FormatCode.Long, (b, v, i) => AmqpBitConverter.WriteLong(b, v)); return; case FormatCode.Symbol32: EncodeArray <AmqpSymbol>(buffer, (IList <AmqpSymbol>)value, count, FormatCode.Symbol32, (b, v, i) => SymbolEncoding.EncodeValue(v, FormatCode.Symbol32, b)); return; case FormatCode.Boolean: EncodeArray <bool>(buffer, (IList <bool>)value, count, FormatCode.Boolean, (b, v, i) => AmqpBitConverter.WriteUByte(b, (byte)(v ? 1 : 0))); return; case FormatCode.UByte: EncodeArray <byte>(buffer, (IList <byte>)value, count, FormatCode.UByte, (b, v, i) => AmqpBitConverter.WriteUByte(b, v)); return; case FormatCode.Byte: EncodeArray <sbyte>(buffer, (IList <sbyte>)value, count, FormatCode.Byte, (b, v, i) => AmqpBitConverter.WriteByte(b, v)); return; case FormatCode.UShort: EncodeArray <ushort>(buffer, (IList <ushort>)value, count, FormatCode.UShort, (b, v, i) => AmqpBitConverter.WriteUShort(b, v)); return; case FormatCode.Short: EncodeArray <short>(buffer, (IList <short>)value, count, FormatCode.Short, (b, v, i) => AmqpBitConverter.WriteShort(b, v)); return; case FormatCode.Float: EncodeArray <float>(buffer, (IList <float>)value, count, FormatCode.Float, (b, v, i) => AmqpBitConverter.WriteFloat(b, v)); return; case FormatCode.Double: EncodeArray <double>(buffer, (IList <double>)value, count, FormatCode.Double, (b, v, i) => AmqpBitConverter.WriteDouble(b, v)); return; case FormatCode.Decimal128: EncodeArray <decimal>(buffer, (IList <decimal>)value, count, FormatCode.Decimal128, (b, v, i) => DecimalEncoding.EncodeValue(v, b)); return; case FormatCode.Char: EncodeArray <char>(buffer, (IList <char>)value, count, FormatCode.Char, (b, v, i) => AmqpBitConverter.WriteChar(b, v)); return; case FormatCode.TimeStamp: EncodeArray <DateTime>(buffer, (IList <DateTime>)value, count, FormatCode.TimeStamp, (b, v, i) => AmqpBitConverter.WriteTimestamp(b, v)); return; case FormatCode.Uuid: EncodeArray <Guid>(buffer, (IList <Guid>)value, count, FormatCode.Uuid, (b, v, i) => AmqpBitConverter.WriteUuid(b, v)); return; default: break; } object firstItem = value[0]; AmqpBitConverter.WriteUByte(buffer, encoding.FormatCode); if (encoding.FormatCode == FormatCode.Described) { DescribedType describedValue = (DescribedType)firstItem; AmqpEncoding.EncodeObject(describedValue.Descriptor, buffer); AmqpBitConverter.WriteUByte(buffer, AmqpEncoding.GetEncoding(describedValue.Value).FormatCode); } for (int i = 0; i < count; i++) { encoding.EncodeObject(value[i], true, buffer); } }