當前位置: 首頁>>代碼示例>>C#>>正文


C# ZStream.deflate方法代碼示例

本文整理匯總了C#中Org.BouncyCastle.Utilities.Zlib.ZStream.deflate方法的典型用法代碼示例。如果您正苦於以下問題:C# ZStream.deflate方法的具體用法?C# ZStream.deflate怎麽用?C# ZStream.deflate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Org.BouncyCastle.Utilities.Zlib.ZStream的用法示例。


在下文中一共展示了ZStream.deflate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: deflateParams

        internal int deflateParams(ZStream strm, int _level, int _strategy){
            int err=Z_OK;

            if(_level == Z_DEFAULT_COMPRESSION){
                _level = 6;
            }
            if(_level < 0 || _level > 9 || 
                _strategy < 0 || _strategy > Z_HUFFMAN_ONLY) {
                return Z_STREAM_ERROR;
            }

            if(config_table[level].func!=config_table[_level].func &&
                strm.total_in != 0) {
                // Flush the last buffer:
                err = strm.deflate(Z_PARTIAL_FLUSH);
            }

            if(level != _level) {
                level = _level;
                max_lazy_match   = config_table[level].max_lazy;
                good_match       = config_table[level].good_length;
                nice_match       = config_table[level].nice_length;
                max_chain_length = config_table[level].max_chain;
            }
            strategy = _strategy;
            return err;
        }
開發者ID:nicecai,項目名稱:iTextSharp-4.1.6,代碼行數:27,代碼來源:Deflate.cs

示例2: deflateParams

        public ZLibStatus deflateParams(ZStream strm, CompressionLevel _level, CompressionStrategy _strategy)
        {
            var err = ZLibStatus.Z_OK;

            if (_level == CompressionLevel.Z_DEFAULT_COMPRESSION)
            {
                _level = (CompressionLevel)6;
            }
            if (_level < 0 || _level > (CompressionLevel)9 ||
                _strategy < 0 || _strategy > CompressionStrategy.Z_HUFFMAN_ONLY)
            {
                return ZLibStatus.Z_STREAM_ERROR;
            }

            if (_configurationTable[level].Function != _configurationTable[_level].Function &&
                strm.total_in != 0)
            {
                // Flush the last buffer:
                err = strm.deflate(FlushType.Z_PARTIAL_FLUSH);
            }

            if (level != _level)
            {
                level = _level;
                max_lazy_match = _configurationTable[level].MaxLazy;
                good_match = _configurationTable[level].GoodLength;
                nice_match = _configurationTable[level].NiceLength;
                max_chain_length = _configurationTable[level].MaxChain;
            }
            strategy = _strategy;
            return err;
        }
開發者ID:imbavirus,項目名稱:TrinityCoreAdmin,代碼行數:32,代碼來源:Deflate.cs


注:本文中的Org.BouncyCastle.Utilities.Zlib.ZStream.deflate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。