public static ITextEncoding GetByName(string textEncoding) { var name = GetName(textEncoding); if (name == "LatinHuffman") { return(new VarLenEncoding(VarLenCharEncoding.FromFrequency <HuffmanEncodingBuilder>(latinFrequencies, true))); } if (name == "LatinHuTucker") { return(new VarLenEncoding(VarLenCharEncoding.FromFrequency <HuTuckerBuilder>(latinFrequencies, true))); } if (name == "LatinHuTuckerBasic") { return(new VarLenEncoding(VarLenCharEncoding.FromFrequency <HuTuckerSimpleBuilder>(latinFrequencies, false))); } if (name == "LatinBalanced") { return(new VarLenEncoding(VarLenCharEncoding.FromFrequency <BalancedByWeightBuilder>(latinFrequencies, true))); } var encoding = Encoding.GetEncoding(name); if (encoding != null) { return(new TextEncoding(encoding)); } throw new Exception("Encoding is not defined"); }
public DecodingMatcherForVarLenCharEncoding(IDfaMatcher <char> matcher, VarLenCharEncoding encoding) { this.matcher = matcher; this.encoding = encoding; this.matcherSteps = new Stack <int>(); Reset(); }
public VarLenEncoding(VarLenCharEncoding encoding) { this.encoding = encoding ?? throw new ArgumentNullException(nameof(encoding)); }