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; } }
internal override void DecodeValue(ByteBuffer buffer) { this.value = Encoder.ReadObject(buffer); }
internal override void DecodeDescriptor(ByteBuffer buffer) { this.descriptor = Encoder.ReadObject(buffer); }
internal override void EncodeValue(ByteBuffer buffer) { Encoder.WriteObject(buffer, this.value); }
internal override void EncodeDescriptor(ByteBuffer buffer) { Encoder.WriteObject(buffer, this.descriptor); }
public static object ReadObject(ByteBuffer buffer) { byte formatCode = Encoder.ReadFormatCode(buffer); return(ReadObject(buffer, formatCode)); }
internal override void EncodeValue(ByteBuffer buffer) { Encoder.WriteMap(buffer, this.map, true); }
internal override void DecodeValue(ByteBuffer buffer) { this.map = Encoder.ReadMap(buffer, Encoder.ReadFormatCode(buffer)); }