Esempio n. 1
0
 public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer)
 {
     if (arrayEncoding)
     {
         AmqpBitConverter.WriteShort(buffer, (short)value);
     }
     else
     {
         ShortEncoding.Encode((short)value, buffer);
     }
 }
Esempio n. 2
0
 public override int GetObjectEncodeSize(object value, bool arrayEncoding)
 {
     if (arrayEncoding)
     {
         return(FixedWidth.Short);
     }
     else
     {
         return(ShortEncoding.GetEncodeSize((short)value));
     }
 }
Esempio n. 3
0
 /// <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));
 }
Esempio n. 4
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);
 }
Esempio n. 5
0
 /// <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));
 }
Esempio n. 6
0
 public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode)
 {
     return(ShortEncoding.Decode(buffer, formatCode));
 }