C# Class Amqp.Types.Encoder

Encodes or decodes AMQP types.
Show file Open project: xamarin/mini-hacks Class Usage Examples

Public Methods

Method Description
AddKnownDescribed ( Amqp.Types.Descriptor descriptor, CreateDescribed ctor ) : void

Adds a factory for a custom described type, usually for decoding.

DateTimeToTimestamp ( System.DateTime dateTime ) : long

Converts a DateTime value to AMQP timestamp (milliseconds from Unix epoch)

ReadArray ( System.ByteBuffer buffer, byte formatCode ) : Array

Reads an array value from a buffer.

ReadBinary ( System.ByteBuffer buffer, byte formatCode ) : byte[]

Reads a binary value from a buffer.

ReadBoolean ( System.ByteBuffer buffer, byte formatCode ) : bool

Reads a boolean value from a buffer.

ReadByte ( System.ByteBuffer buffer, byte formatCode ) : sbyte

Reads a signed byte from a buffer.

ReadChar ( System.ByteBuffer buffer, byte formatCode ) : char

Reads a char value from a buffer.

ReadDescribed ( System.ByteBuffer buffer, byte formatCode ) : object

Reads a described value from a buffer.

ReadDouble ( System.ByteBuffer buffer, byte formatCode ) : double

Reads a 64-bit floating-point value from a buffer.

ReadFloat ( System.ByteBuffer buffer, byte formatCode ) : float

Reads a 32-bit floating-point value from a buffer.

ReadInt ( System.ByteBuffer buffer, byte formatCode ) : int

Reads a signed 32-bit integer from a buffer.

ReadList ( System.ByteBuffer buffer, byte formatCode ) : List

Reads a list value from a buffer.

ReadLong ( System.ByteBuffer buffer, byte formatCode ) : long

Reads a signed 64-bit integer from a buffer.

ReadMap ( System.ByteBuffer buffer, byte formatCode ) : Amqp.Types.Map

Reads a map value from a buffer.

ReadObject ( System.ByteBuffer buffer ) : object

Reads an object from a buffer.

ReadObject ( System.ByteBuffer buffer, byte formatCode ) : object

Reads an object from a buffer.

ReadShort ( System.ByteBuffer buffer, byte formatCode ) : short

Reads a signed 16-bit integer from a buffer.

ReadString ( System.ByteBuffer buffer, byte formatCode ) : string

Reads a string value from a buffer.

ReadSymbol ( System.ByteBuffer buffer, byte formatCode ) : Amqp.Types.Symbol

Reads a symbol value from a buffer.

ReadTimestamp ( System.ByteBuffer buffer, byte formatCode ) : System.DateTime

Reads a timestamp value from a buffer.

ReadUByte ( System.ByteBuffer buffer, byte formatCode ) : byte

Reads an unsigned byte value from a buffer.

ReadUInt ( System.ByteBuffer buffer, byte formatCode ) : uint

Reads an unsigned 32-bit integer from a buffer.

ReadULong ( System.ByteBuffer buffer, byte formatCode ) : ulong

Reads an unsigned 64-bit integer from a buffer.

ReadUShort ( System.ByteBuffer buffer, byte formatCode ) : ushort

Reads an unsigned 16-bit integer from a buffer.

ReadUuid ( System.ByteBuffer buffer, byte formatCode ) : System.Guid

Reads a uuid value from a buffer.

TimestampToDateTime ( long timestamp ) : System.DateTime

Converts an AMQP timestamp ((milliseconds from Unix epoch)) to a DateTime.

WriteArray ( System.ByteBuffer buffer, Array value ) : void

Writes an array value to a buffer.

WriteBinary ( System.ByteBuffer buffer, byte value, bool smallEncoding ) : void

Writes a binary value to a buffer.

WriteBoolean ( System.ByteBuffer buffer, bool value, bool smallEncoding ) : void

Writes a boolean value to a buffer.

WriteByte ( System.ByteBuffer buffer, sbyte value ) : void

Writes a signed byte value to a buffer.

WriteChar ( System.ByteBuffer buffer, char value ) : void

Writes a char value to a buffer.

WriteDouble ( System.ByteBuffer buffer, double value ) : void

Writes a 64-bit floating-point value to a buffer.

WriteFloat ( System.ByteBuffer buffer, float value ) : void

Writes a 32-bit floating-point value to a buffer.

WriteInt ( System.ByteBuffer buffer, int value, bool smallEncoding ) : void

Writes a signed 32-bit integer value to a buffer.

WriteList ( System.ByteBuffer buffer, IList value, bool smallEncoding ) : void

Writes a list value to a buffer.

WriteLong ( System.ByteBuffer buffer, long value, bool smallEncoding ) : void

Writes a signed 64-bit integer value to a buffer.

WriteMap ( System.ByteBuffer buffer, Amqp.Types.Map value, bool smallEncoding ) : void

Writes a map value to a buffer.

WriteObject ( System.ByteBuffer buffer, object value, bool smallEncoding = true ) : void

Writes an AMQP object to a buffer.

WriteShort ( System.ByteBuffer buffer, short value ) : void

Writes a signed 16-bit integer value to a buffer.

WriteString ( System.ByteBuffer buffer, string value, bool smallEncoding ) : void

Writes a string value to a buffer.

WriteSymbol ( System.ByteBuffer buffer, Amqp.Types.Symbol value, bool smallEncoding ) : void

Writes a symbol value to a buffer.

WriteTimestamp ( System.ByteBuffer buffer, System.DateTime value ) : void

Writes a timestamp value to a buffer.

WriteUByte ( System.ByteBuffer buffer, byte value ) : void

Writes an unsigned byte value to a buffer.

WriteUInt ( System.ByteBuffer buffer, uint value, bool smallEncoding ) : void

Writes an unsigned 32-bit integer value to a buffer.

WriteULong ( System.ByteBuffer buffer, ulong value, bool smallEncoding ) : void

Writes an unsigned 64-bit integer value to a buffer.

WriteUShort ( System.ByteBuffer buffer, ushort value ) : void

Writes an unsigned 16-bit integer value to a buffer.

WriteUuid ( System.ByteBuffer buffer, System.Guid value ) : void

Writes a uuid value to a buffer.

Private Methods

Method Description
Encoder ( ) : System
GetSerializer ( byte formatCode ) : Serializer
Initialize ( ) : void
InvalidFormatCodeException ( byte formatCode, int offset ) : AmqpException
InvalidFormatCodeException ( byte formatCode, int offset ) : Exception
InvalidMapCountException ( int count ) : AmqpException
InvalidMapCountException ( int count ) : Exception
ReadBinaryBuffer ( System.ByteBuffer buffer ) : System.ByteBuffer
ReadFormatCode ( System.ByteBuffer buffer ) : byte
ReadString ( System.ByteBuffer buffer, byte formatCode, byte code8, byte code32, string type ) : string
TryGetCodec ( Type type, Encode &encoder, Decode &decoder ) : bool
TypeNotSupportedException ( Type type ) : AmqpException
TypeNotSupportedException ( Type type ) : Exception
WriteBinaryBuffer ( System.ByteBuffer buffer, System.ByteBuffer value ) : void

Method Details

AddKnownDescribed() public static method

Adds a factory for a custom described type, usually for decoding.
public static AddKnownDescribed ( Amqp.Types.Descriptor descriptor, CreateDescribed ctor ) : void
descriptor Amqp.Types.Descriptor The descriptor of the type.
ctor CreateDescribed The delegate to invoke to create the object.
return void

DateTimeToTimestamp() public static method

Converts a DateTime value to AMQP timestamp (milliseconds from Unix epoch)
public static DateTimeToTimestamp ( System.DateTime dateTime ) : long
dateTime System.DateTime The DateTime value to convert.
return long

ReadArray() public static method

Reads an array value from a buffer.
public static ReadArray ( System.ByteBuffer buffer, byte formatCode ) : Array
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return System.Array

ReadBinary() public static method

Reads a binary value from a buffer.
public static ReadBinary ( System.ByteBuffer buffer, byte formatCode ) : byte[]
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return byte[]

ReadBoolean() public static method

Reads a boolean value from a buffer.
public static ReadBoolean ( System.ByteBuffer buffer, byte formatCode ) : bool
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return bool

ReadByte() public static method

Reads a signed byte from a buffer.
public static ReadByte ( System.ByteBuffer buffer, byte formatCode ) : sbyte
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return sbyte

ReadChar() public static method

Reads a char value from a buffer.
public static ReadChar ( System.ByteBuffer buffer, byte formatCode ) : char
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return char

ReadDescribed() public static method

Reads a described value from a buffer.
public static ReadDescribed ( System.ByteBuffer buffer, byte formatCode ) : object
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return object

ReadDouble() public static method

Reads a 64-bit floating-point value from a buffer.
public static ReadDouble ( System.ByteBuffer buffer, byte formatCode ) : double
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return double

ReadFloat() public static method

Reads a 32-bit floating-point value from a buffer.
public static ReadFloat ( System.ByteBuffer buffer, byte formatCode ) : float
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return float

ReadInt() public static method

Reads a signed 32-bit integer from a buffer.
public static ReadInt ( System.ByteBuffer buffer, byte formatCode ) : int
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return int

ReadList() public static method

Reads a list value from a buffer.
public static ReadList ( System.ByteBuffer buffer, byte formatCode ) : List
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return List

ReadLong() public static method

Reads a signed 64-bit integer from a buffer.
public static ReadLong ( System.ByteBuffer buffer, byte formatCode ) : long
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return long

ReadMap() public static method

Reads a map value from a buffer.
public static ReadMap ( System.ByteBuffer buffer, byte formatCode ) : Amqp.Types.Map
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return Amqp.Types.Map

ReadObject() public static method

Reads an object from a buffer.
public static ReadObject ( System.ByteBuffer buffer ) : object
buffer System.ByteBuffer The buffer to read.
return object

ReadObject() public static method

Reads an object from a buffer.
public static ReadObject ( System.ByteBuffer buffer, byte formatCode ) : object
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return object

ReadShort() public static method

Reads a signed 16-bit integer from a buffer.
public static ReadShort ( System.ByteBuffer buffer, byte formatCode ) : short
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return short

ReadString() public static method

Reads a string value from a buffer.
public static ReadString ( System.ByteBuffer buffer, byte formatCode ) : string
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return string

ReadSymbol() public static method

Reads a symbol value from a buffer.
public static ReadSymbol ( System.ByteBuffer buffer, byte formatCode ) : Amqp.Types.Symbol
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return Amqp.Types.Symbol

ReadTimestamp() public static method

Reads a timestamp value from a buffer.
public static ReadTimestamp ( System.ByteBuffer buffer, byte formatCode ) : System.DateTime
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return System.DateTime

ReadUByte() public static method

Reads an unsigned byte value from a buffer.
public static ReadUByte ( System.ByteBuffer buffer, byte formatCode ) : byte
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return byte

ReadUInt() public static method

Reads an unsigned 32-bit integer from a buffer.
public static ReadUInt ( System.ByteBuffer buffer, byte formatCode ) : uint
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return uint

ReadULong() public static method

Reads an unsigned 64-bit integer from a buffer.
public static ReadULong ( System.ByteBuffer buffer, byte formatCode ) : ulong
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return ulong

ReadUShort() public static method

Reads an unsigned 16-bit integer from a buffer.
public static ReadUShort ( System.ByteBuffer buffer, byte formatCode ) : ushort
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return ushort

ReadUuid() public static method

Reads a uuid value from a buffer.
public static ReadUuid ( System.ByteBuffer buffer, byte formatCode ) : System.Guid
buffer System.ByteBuffer The buffer to read.
formatCode byte The format code of the value.
return System.Guid

TimestampToDateTime() public static method

Converts an AMQP timestamp ((milliseconds from Unix epoch)) to a DateTime.
public static TimestampToDateTime ( long timestamp ) : System.DateTime
timestamp long The AMQP timestamp to convert.
return System.DateTime

WriteArray() public static method

Writes an array value to a buffer.
public static WriteArray ( System.ByteBuffer buffer, Array value ) : void
buffer System.ByteBuffer The buffer to write.
value System.Array The array value.
return void

WriteBinary() public static method

Writes a binary value to a buffer.
public static WriteBinary ( System.ByteBuffer buffer, byte value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value byte The binary value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteBoolean() public static method

Writes a boolean value to a buffer.
public static WriteBoolean ( System.ByteBuffer buffer, bool value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value bool The boolean value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteByte() public static method

Writes a signed byte value to a buffer.
public static WriteByte ( System.ByteBuffer buffer, sbyte value ) : void
buffer System.ByteBuffer The buffer to write.
value sbyte The signed byte value.
return void

WriteChar() public static method

Writes a char value to a buffer.
public static WriteChar ( System.ByteBuffer buffer, char value ) : void
buffer System.ByteBuffer The buffer to write.
value char The char value.
return void

WriteDouble() public static method

Writes a 64-bit floating-point value to a buffer.
public static WriteDouble ( System.ByteBuffer buffer, double value ) : void
buffer System.ByteBuffer The buffer to write.
value double The 64-bit floating-point value.
return void

WriteFloat() public static method

Writes a 32-bit floating-point value to a buffer.
public static WriteFloat ( System.ByteBuffer buffer, float value ) : void
buffer System.ByteBuffer The buffer to write.
value float The 32-bit floating-point value.
return void

WriteInt() public static method

Writes a signed 32-bit integer value to a buffer.
public static WriteInt ( System.ByteBuffer buffer, int value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value int The signed 32-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteList() public static method

Writes a list value to a buffer.
public static WriteList ( System.ByteBuffer buffer, IList value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value IList The list value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteLong() public static method

Writes a signed 64-bit integer value to a buffer.
public static WriteLong ( System.ByteBuffer buffer, long value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value long The signed 64-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteMap() public static method

Writes a map value to a buffer.
public static WriteMap ( System.ByteBuffer buffer, Amqp.Types.Map value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value Amqp.Types.Map The map value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteObject() public static method

Writes an AMQP object to a buffer.
public static WriteObject ( System.ByteBuffer buffer, object value, bool smallEncoding = true ) : void
buffer System.ByteBuffer The buffer to write.
value object The AMQP value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteShort() public static method

Writes a signed 16-bit integer value to a buffer.
public static WriteShort ( System.ByteBuffer buffer, short value ) : void
buffer System.ByteBuffer The buffer to write.
value short The signed 16-bit integer value.
return void

WriteString() public static method

Writes a string value to a buffer.
public static WriteString ( System.ByteBuffer buffer, string value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value string The string value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteSymbol() public static method

Writes a symbol value to a buffer.
public static WriteSymbol ( System.ByteBuffer buffer, Amqp.Types.Symbol value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value Amqp.Types.Symbol The symbol value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteTimestamp() public static method

Writes a timestamp value to a buffer.
public static WriteTimestamp ( System.ByteBuffer buffer, System.DateTime value ) : void
buffer System.ByteBuffer The buffer to write.
value System.DateTime The timestamp value which is the milliseconds since UNIX epoch.
return void

WriteUByte() public static method

Writes an unsigned byte value to a buffer.
public static WriteUByte ( System.ByteBuffer buffer, byte value ) : void
buffer System.ByteBuffer The buffer to write.
value byte The unsigned byte value.
return void

WriteUInt() public static method

Writes an unsigned 32-bit integer value to a buffer.
public static WriteUInt ( System.ByteBuffer buffer, uint value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value uint The unsigned 32-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteULong() public static method

Writes an unsigned 64-bit integer value to a buffer.
public static WriteULong ( System.ByteBuffer buffer, ulong value, bool smallEncoding ) : void
buffer System.ByteBuffer The buffer to write.
value ulong The unsigned 64-bit integer value.
smallEncoding bool if true, try using small encoding if possible.
return void

WriteUShort() public static method

Writes an unsigned 16-bit integer value to a buffer.
public static WriteUShort ( System.ByteBuffer buffer, ushort value ) : void
buffer System.ByteBuffer The buffer to write.
value ushort The unsigned 16-bit integer value.
return void

WriteUuid() public static method

Writes a uuid value to a buffer.
public static WriteUuid ( System.ByteBuffer buffer, System.Guid value ) : void
buffer System.ByteBuffer The buffer to write.
value System.Guid The uuid value.
return void