public override void EncodeObject(object value, bool arrayEncoding, ByteBuffer buffer) { if (arrayEncoding) { AmqpBitConverter.WriteUByte(buffer, (byte)value); } else { UByteEncoding.Encode((byte)value, buffer); } }
public override int GetObjectEncodeSize(object value, bool arrayEncoding) { if (arrayEncoding) { return(FixedWidth.UByte); } else { return(UByteEncoding.GetEncodeSize((byte)value)); } }
/// <summary> /// Decodes an 8-bit unsigned integer from the buffer and advances the buffer's position. /// </summary> /// <param name="buffer">The buffer to read.</param> /// <returns>An 8-bit unsigned integer.</returns> public static byte?DecodeUByte(ByteBuffer buffer) { return(UByteEncoding.Decode(buffer, 0)); }
/// <summary> /// Encodes an 8-bit unsigned integer and appends the bytes to the buffer. /// </summary> /// <param name="data">The 8-bit unsigned integer.</param> /// <param name="buffer">The destination buffer.</param> public static void EncodeUByte(byte?data, ByteBuffer buffer) { UByteEncoding.Encode(data, buffer); }
/// <summary> /// Gets the encode size of an 8-bit unsigned integer. /// </summary> /// <param name="value">The 8-bit unsigned integer.</param> /// <returns>Encode size in bytes of the 8-bit unsigned integer.</returns> public static int GetUByteEncodeSize(byte?value) { return(UByteEncoding.GetEncodeSize(value)); }
public override object DecodeObject(ByteBuffer buffer, FormatCode formatCode) { return(UByteEncoding.Decode(buffer, formatCode)); }