public static CompressionHandler Load(Stream stream)
        {
            using (var br = new BinaryReader(stream, Encoding.UTF8, leaveOpen: true))
            {
                if (br.Read7BitEncodedInt() != 1337)
                {
                    throw new InvalidDataException("Not a saved compression handler");
                }
                if (br.Read7BitEncodedInt() != 1)
                {
                    throw new InvalidDataException("Not a known version");
                }

                var dicLen = br.Read7BitEncodedInt();

                var readBytes = br.ReadBytes(dicLen);

                var packer = HuffmanPacker.Load(br);

                return(new CompressionHandler(readBytes, packer));
            }
        }
 public CompressionHandler(byte[] dictionary, HuffmanPacker packer)
 {
     _dictionary = dictionary;
     _packer = packer;
     _substringPacker = new SubstringPacker(_dictionary);
 }
 public CompressionHandler(byte[] dictionary, HuffmanPacker packer)
 {
     _dictionary      = dictionary;
     _packer          = packer;
     _substringPacker = new SubstringPacker(_dictionary);
 }