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;
            }
        }
Exemplo n.º 2
0
 internal override void DecodeValue(ByteBuffer buffer)
 {
     this.value = Encoder.ReadObject(buffer);
 }
Exemplo n.º 3
0
 internal override void DecodeDescriptor(ByteBuffer buffer)
 {
     this.descriptor = Encoder.ReadObject(buffer);
 }
Exemplo n.º 4
0
 internal override void EncodeValue(ByteBuffer buffer)
 {
     Encoder.WriteObject(buffer, this.value);
 }
Exemplo n.º 5
0
 internal override void EncodeDescriptor(ByteBuffer buffer)
 {
     Encoder.WriteObject(buffer, this.descriptor);
 }
Exemplo n.º 6
0
        public static object ReadObject(ByteBuffer buffer)
        {
            byte formatCode = Encoder.ReadFormatCode(buffer);

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