public string CompressDebug(string input) { var bytes = Encoding.UTF8.GetBytes(input); var consumerContext = new StringWriter(); _substringPacker.Pack(bytes, new DebugPackerOutput(), consumerContext); return(consumerContext.GetStringBuilder().ToString()); }
public CompressionHandler CreateHandler(int desiredLength = 1024 *32) { var dictionary = _dictionaryOptimizer.Optimize(desiredLength); var training = new SubstringPacker(dictionary); var huffmanTableTrainer = new HuffmanTableTrainer(); foreach (var document in _dictionaryOptimizer.Documents) { training.Pack(document, huffmanTableTrainer, null); } var packer = huffmanTableTrainer.GeneratePacker(); return(new CompressionHandler(dictionary, packer)); }