Encodes or decodes AMQP types.
        public void KnownString_UsedInEncoder()
        {
            try
            {
                WellknownStringDecoder decoder = new WellknownStringDecoder();
                decoder.AddWellknownString("abc");

                Encoder.StringDecoder = decoder;

                ByteBuffer buffer = new ByteBuffer(128, true);

                Encoder.WriteString(buffer, "abc", true);
                Encoder.WriteString(buffer, "abc", true);

                buffer.Seek(0);

                string decodedString1 = Encoder.ReadString(buffer, Encoder.ReadFormatCode(buffer));
                string decodedString2 = Encoder.ReadString(buffer, Encoder.ReadFormatCode(buffer));

                Assert.IsTrue(ReferenceEquals(decodedString1, decodedString2));
            }
            finally
            {
                Encoder.StringDecoder = null;
            }
        }
Beispiel #2
0
 internal override void DecodeValue(ByteBuffer buffer)
 {
     this.value = Encoder.ReadObject(buffer);
 }
Beispiel #3
0
 internal override void DecodeDescriptor(ByteBuffer buffer)
 {
     this.descriptor = Encoder.ReadObject(buffer);
 }
Beispiel #4
0
 internal override void EncodeValue(ByteBuffer buffer)
 {
     Encoder.WriteObject(buffer, this.value);
 }
Beispiel #5
0
 internal override void EncodeDescriptor(ByteBuffer buffer)
 {
     Encoder.WriteObject(buffer, this.descriptor);
 }
Beispiel #6
0
        public static object ReadObject(ByteBuffer buffer)
        {
            byte formatCode = Encoder.ReadFormatCode(buffer);

            return(ReadObject(buffer, formatCode));
        }
Beispiel #7
0
 internal override void EncodeValue(ByteBuffer buffer)
 {
     Encoder.WriteMap(buffer, this.map, true);
 }
Beispiel #8
0
 internal override void DecodeValue(ByteBuffer buffer)
 {
     this.map = Encoder.ReadMap(buffer, Encoder.ReadFormatCode(buffer));
 }