void Encode() { Assert.Equal("bcd", _coder.Encode("abc")); Assert.Equal("234", _coder.Encode("123")); Assert.Equal("yza", _coder.Encode("xyz")); Assert.Equal("анб", _coder.Encode("яма")); }
public void Encode() { Dictionary <byte, int> symbolQuantityDic = createDictionary(); var builder = new HuffmanCodecBuilder <byte>(); var tree = builder.BuildTree(Comparer <byte> .Default, symbolQuantityDic); ICoder <byte> huffmanCoder = builder.GetCoder(tree); huffmanCoder.Encode(new StandardHuffmanCoderInput(inputReader), new HuffmanCoderOutput(coderOutputWriter)); coderOutputWriter.CreateFileBytes(HuffmanEncodeModel.Standard, false, SymbolQuantityMapConverter.StandardIntToExtConvert(symbolQuantityDic, huffmanCoder.GetEncodingDictionary())); }
public void Send(Protobuf protobuf) { if(socket == null || !socket.Connected) { UnityEngine.Debug.LogError("Socket was not established!"); return; } beforeSendProto(protobuf); var data = coder.Encode(protobuf); socket.BeginSend(data, 0, data.Length, SocketFlags.None, beginSendCallback, socket); }
private static string Encrypt(ICoder coder, string inputString) { return(coder.Encode(inputString)); }
void Encode() { Assert.Equal("zyx", _coder.Encode("abc")); Assert.Equal("cba", _coder.Encode("xyz")); Assert.Equal("яа", _coder.Encode("ая")); }
private void encode(string source, ICoder coder) { _data = coder.Encode(source, out _length); }