static private Encode ( byte encodedData, int width, ByteBuffer buffer ) : void | ||
encodedData | byte | |
width | int | |
buffer | ByteBuffer | |
return | void |
public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (arrayEncoding) { StringEncoding.Encode(Encoding.UTF8.GetBytes((string)value), FixedWidth.UInt, buffer); } else { StringEncoding.Encode((string)value, buffer); } }
public static void Encode(string value, ByteBuffer buffer) { if (value == null) { AmqpEncoding.EncodeNull(buffer); } else { byte[] encodedData = Encoding.UTF8.GetBytes(value); int encodeWidth = AmqpEncoding.GetEncodeWidthBySize(encodedData.Length); AmqpBitConverter.WriteUByte(buffer, encodeWidth == FixedWidth.UByte ? FormatCode.String8Utf8 : FormatCode.String32Utf8); StringEncoding.Encode(encodedData, encodeWidth, buffer); } }