public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (arrayEncoding) { AmqpBitConverter.WriteShort(buffer, (short)value); } else { ShortEncoding.Encode((short)value, buffer); } }
public override int GetObjectEncodeSize(object value, bool arrayEncoding) { if (arrayEncoding) { return(FixedWidth.Short); } else { return(ShortEncoding.GetEncodeSize((short)value)); } }
/// <summary> /// Decodes a 16-bit signed integer from the buffer and advances the buffer's position. /// </summary> /// <param name="buffer">The buffer to read.</param> /// <returns>A 16-bit signed integer.</returns> public static short?DecodeShort(ByteBuffer buffer) { return(ShortEncoding.Decode(buffer, 0)); }
/// <summary> /// Encodes a 16-bit signed integer and appends the bytes to the buffer. /// </summary> /// <param name="data">The 16-bit signed integer.</param> /// <param name="buffer">The destination buffer.</param> public static void EncodeShort(short?data, ByteBuffer buffer) { ShortEncoding.Encode(data, buffer); }
/// <summary> /// Gets the encode size of a 16-bit signed integer. /// </summary> /// <param name="value">The 16-bit signed integer.</param> /// <returns>Encode size in bytes of the 16-bit signed integer.</returns> public static int GetShortEncodeSize(short?value) { return(ShortEncoding.GetEncodeSize(value)); }
public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode) { return(ShortEncoding.Decode(buffer, formatCode)); }