本文整理匯總了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;
}
示例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;
}