/// <summary>
        /// Set the deflate level (0-9)
        /// </summary>
        public void SetLevel(int lvl)
        {
            goodLength = DeflaterConstants.GOOD_LENGTH[lvl];
            max_lazy   = DeflaterConstants.MAX_LAZY[lvl];
            niceLength = DeflaterConstants.NICE_LENGTH[lvl];
            max_chain  = DeflaterConstants.MAX_CHAIN[lvl];

            if (DeflaterConstants.COMPR_FUNC[lvl] != comprFunc)
            {
                //				if (DeflaterConstants.DEBUGGING) {
                //					//Console.WriteLine("Change from " + comprFunc + " to "
                //					                  + DeflaterConstants.COMPR_FUNC[lvl]);
                //				}
                switch (comprFunc)
                {
                case DEFLATE_STORED:
                    if (strstart > blockStart)
                    {
                        huffman.FlushStoredBlock(window, blockStart,
                                                 strstart - blockStart, false);
                        blockStart = strstart;
                    }
                    UpdateHash();
                    break;

                case DEFLATE_FAST:
                    if (strstart > blockStart)
                    {
                        huffman.FlushBlock(window, blockStart, strstart - blockStart,
                                           false);
                        blockStart = strstart;
                    }
                    break;

                case DEFLATE_SLOW:
                    if (prevAvailable)
                    {
                        huffman.TallyLit(window[strstart - 1] & 0xff);
                    }
                    if (strstart > blockStart)
                    {
                        huffman.FlushBlock(window, blockStart, strstart - blockStart, false);
                        blockStart = strstart;
                    }
                    prevAvailable = false;
                    matchLen      = MIN_MATCH - 1;
                    break;
                }
                comprFunc = COMPR_FUNC[lvl];
            }
        }