public void Decode(IDecoderInput input, IDecoderOutput <T> output) { while (!output.IsEnd()) { input.Read(); output.Write(symbol); } }
private void Decode(IDecoderInput input, IDecoderOutput <T> output, IHuffmanTreeNode <T> currentNode) { while (!output.IsEnd()) { var bit = input.Read(); currentNode = bit ? currentNode.RightChild : currentNode.LeftChild; if (currentNode.IsLeaf) { output.Write(currentNode.Value); currentNode = root; } } }
/// <summary> /// Constructs a new LzwDecoder instance with the given input, output and string table instances. /// </summary> /// <param name="input">An IDecoderInput implementation to read codes from.</param> /// <param name="output">An IDecoderOutput implementation to write strings to.</param> /// <param name="stringTable">An IStringTable implementation to translate read codes into strings.</param> public LzwDecoder(IDecoderInput input, IDecoderOutput output, IStringTable stringTable) { this.input = input; this.output = output; this.stringTable = stringTable; }
public void Decode(IDecoderInput input, IDecoderOutput <T> output) { Decode(input, output, root); }