CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
英特尔®游戏设计大赛100美元现金周周送 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  扩充话题 >  程序员英语

希望大家帮忙,100分答谢!

楼主mibo2(puppet)2003-11-04 14:57:00 在 扩充话题 / 程序员英语 提问

 
  int   deflateSetDictionary   (z_streamp   strm,   const   Bytef   *dictionary,   uInt   dictLength);    
  Initializes   the   compression   dictionary   from   the   given   byte   sequence   without   producing   any   compressed   output.   This   function   must   be   called   immediately   after   deflateInit,   deflateInit2   or   deflateReset,   before   any   call   of   deflate.   The   compressor   and   decompressor   must   use   exactly   the   same   dictionary   (see   inflateSetDictionary).  
  The   dictionary   should   consist   of   strings   (byte   sequences)   that   are   likely   to   be   encountered   later   in   the   data   to   be   compressed,   with   the   most   commonly   used   strings   preferably   put   towards   the   end   of   the   dictionary.   Using   a   dictionary   is   most   useful   when   the   data   to   be   compressed   is   short   and   can   be   predicted   with   good   accuracy   ;   the   data   can   then   be   compressed   better   than   with   the   default   empty   dictionary.  
   
  Depending   on   the   size   of   the   compression   data   structures   selected   by   deflateInit   or   deflateInit2,   a   part   of   the   dictionary   may   in   effect   be   discarded,   for   example   if   the   dictionary   is   larger   than   the   window   size   in   deflate   or   deflate2.   Thus   the   strings   most   likely   to   be   useful   should   be   put   at   the   end   of   the   dictionary,   not   at   the   front.  
   
  Upon   return   of   this   function,   strm->   adler   is   set   to   the   Adler32   value   of   the   dictionary   ;   the   decompressor   may   later   use   this   value   to   determine   which   dictionary   has   been   used   by   the   compressor.   (The   Adler32   value   applies   to   the   whole   dictionary   even   if   only   a   subset   of   the   dictionary   is   actually   used   by   the   compressor.)  
   
  deflateSetDictionary   returns   Z_OK   if   success,   or   Z_STREAM_ERROR   if   a   parameter   is   invalid   (such   as   NULL   dictionary)   or   the   stream   state   is   inconsistent   (for   example   if   deflate   has   already   been   called   for   this   stream   or   if   the   compression   method   is   bsort).   deflateSetDictionary   does   not   perform   any   compression:   this   will   be   done   by   deflate().  
   
   
  问题点数:100、回复次数:4Top

1 楼2000mylove(nothing)回复于 2003-11-05 17:42:46 得分 50

int   deflateSetDictionary   (z_streamp   strm,   const   Bytef   *dictionary,   uInt   dictLength);  
  在不产生任何压缩输出的情况下按给定的字节序列初始化压缩字典,必须在deflateInit,   deflateInit2   或者   deflateReset调用之后,以及任何压缩动作之前调用这个函数。压缩装置和解压缩装置必须严格的使用相同的字典(参考inflateSetDictionary)。  
   
  字典应该包括在以后的压缩中有可能遇到的字符串,使用最普遍的字符串应该放在字典的后部。当数据内容不是太长并且可预见性很好的时候使用字典将会非常有利;数据将获得比用默认的空字典更好的压缩效果。  
   
  根据deflateInit   或者   deflateInit2   所选的压缩数据结构的尺寸,实际上字典的一部分是没用的,例如字典的尺寸大于deflate   或者   deflate2中的窗口的尺寸。所以最有可能用到的字符串不是被放在字典的前部,而是放在后部。  
   
  在这个函数返回之前strm的adler函数将开始对字典的Adler32值的工作。稍后解压缩装置将依赖这个值决定压缩装置使用的是哪个字典。(Adler32值将适用于整个字典,即使事实上压缩只用到了字典的一个子集)  
   
  deflateSetDictionary函数如果执行成功,将返回Z_OK,如果一个参数无效(例如字典为空)或者流状态不一致(例如是否已经对这个流调用过deflate或者压缩的方法已经   bsort没见过这个单词啊)将返回Z_STREAM_ERROR。deflateSetDictionary函数不完成任何压缩:这将在deflate()函数中完成  
   
   
  最近比较忙,又没有接触过压缩方面的资料,  
  老兄凑合着看啦  
  我时间比较紧  
   
  QQ:85652551  
  E-mail:   ycg1213@21cn.comTop

2 楼2000mylove(nothing)回复于 2003-11-05 17:44:10 得分 0

第二段中的字符串可能用流更合适些Top

3 楼snelgar(晓枫)回复于 2003-11-05 17:45:30 得分 50

int   deflateSetDictionary   (z_streamp   strm,   const   Bytef   *dictionary,   uInt   dictLength);    
  deflateSetDictionary   根据收到的字节顺序初始化压缩字典,但不生成任何压缩数据。必须在调用deflateInit,   deflateInit2   或   deflateReset这三个函数之后立刻调用deflateSetDictionary   函数,然后才能调用deflate。压缩模块和解压缩模块必须使用完全相同的压缩字典(具体参见deflateSetDictionary   )  
  压缩字典应由那些有可能在待压缩数据中出现的字符串依照字节顺序排列而成,其中最常出现的字符串被放在字典的最后。当待压缩数据较短且能被很精确的预测出时,使用压缩字典是大有裨益的;相对于缺省不使用压缩字典的情况下,数据能够被更快地压缩。  
  依赖于deflateInit或deflateInit2函数选取的压缩数据结构的大小,压缩字典中的一部分实际上可能会被丢弃,例如字典的大小超过了deflate或deflate2函数中压缩窗口的大小。这样最有可能被用到的字符串应该被置于字典的最后,而不是字典的开头。  
  取决于(根据)本函数的返回值,strm->   adler   被置为压缩字典的Adler32值;解压模块以后可能会使用这个值来确定压缩模块所使用的压缩字典。(直译:Adler32值应用于整个压缩字典,即使压缩模块实际上只使用了字典中的一部分。意译:即使压缩模块实际上只使用了字典中的一部分,也要置整个字典的Adler32值)  
  成功deflateSetDictionary   返回Z_OK,参数不合法则返回Z_STREAM_ERROR   (例如字典为空)或流状态不一致(例如已经对该流调用了deflate函数或压缩方法(bsort)??)deflateSetDictionary   函数本省不进行任何数据压缩,这一工作由deflate()函数完成  
   
  Top

4 楼snelgar(晓枫)回复于 2003-11-05 18:20:42 得分 0

int   deflateSetDictionary   (z_streamp   strm,   const   Bytef   *dictionary,   uInt   dictLength);    
  deflateSetDictionary   根据收到的字节顺序初始化压缩字典,但不生成任何压缩数据。必须在调用deflateInit,   deflateInit2   或   deflateReset这三个函数之后,同时尚未调用deflate()执行压缩之前,立刻调用deflateSetDictionary   函数。压缩模块和解压缩模块必须使用完全相同的压缩字典(具体参见deflateSetDictionary   )  
   
  压缩字典应由那些有可能在待压缩数据中出现的字符串依照字节顺序排列而成,其中最常出现的字符串更宜于被放在字典的后部。当待压缩数据较短且能被很精确的预测出时,使用压缩字典是大有裨益的;相对于缺省不使用压缩字典的情况下,数据能够被更快地压缩。  
   
  依赖于deflateInit或deflateInit2函数选取的压缩数据结构的大小,压缩字典中的一部分实际上可能会被丢弃,例如压缩字典的尺寸超过了deflate或deflate2函数中压缩窗口的大小。这样最有可能被用到的字符串应该被置于字典的后部,而不是字典的前部。  
   
  在本函数的返回之前,strm->   adler   被置为压缩字典的Adler32值;解压模块以后可能会使用这个值来确定压缩模块所使用的压缩字典。(直译:Adler32值应用于整个压缩字典,即使压缩模块实际上只使用了字典中的一部分。意译:即使压缩模块实际上只使用了字典中的一部分,也要置整个字典的Adler32值)  
   
  deflateSetDictionary执行成功将返回Z_OK,参数不合法则返回Z_STREAM_ERROR   (例如字典为空)或流状态不一致(例如已经对该流调用了deflate函数或压缩方法(bsort)??)deflateSetDictionary   函数本身不进行任何数据压缩,这一工作由deflate()函数完成  
   
  修正一些错误!  
  sorry,刚才看得不够仔细!  
   
  Top

相关问题

  • 答谢FANS~~~~~~
  • 答谢PIGO
  • 答谢houzh,无内容。
  • 答谢yyy_5(yyy_5),进来! 
  • 答谢fengdu解决问题。
  • 放水啦,答谢会!
  • 答谢cxz7531(大花猫)
  • 答谢 interpb(曾曾胡)
  • 请教高手--高分答谢
  • 50分答谢启蒙老师!

关键词

  • 函数
  • 模块
  • 数据
  • 装置
  • 数据结构
  • 压缩
  • 字典
  • deflatesetdictionary
  • deflateinit
  • deflate

得分解答快速导航

  • 帖主:mibo2
  • 2000mylove
  • snelgar

相关链接

  • CSDN Blog
  • 技术文档
  • 代码下载
  • 第二书店
  • 读书频道

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo