net framework 20 中新增的两个压缩类(Two new compression classes in net framework 20).docVIP

net framework 20 中新增的两个压缩类(Two new compression classes in net framework 20).doc

  1. 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
  2. 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载
  3. 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
  4. 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
  5. 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们
  6. 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
  7. 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
net framework 20 中新增的两个压缩类(Two new compression classes in net framework 20)

net framework 20 中新增的两个压缩类(Two new compression classes in net framework 20) pression 命名空间 注意: 此命名空间在. net framework 2.0 版中是新增的. pression 命名空间包含提供基本的流压缩和解压缩服务的类. (downmoon原作) 类 说明 deflatestream 提供用于使用 deflate 算法压缩和解压缩流的方法和属性. gzipstream 提供用于压缩和解压缩流的方法和属性. 枚举 说明 compressionmode 指定是否压缩或解压缩基础流. 下面以 gzipstream 为例说明 注意: 此类在. net framework 2.0 版中是新增的. 提供用于压缩和解压缩流的方法和属性. 命名空间: pression 程序集: system (在 system.dll 中) 语法 visual basic (声明) public class gzipstream inherits stream visual basic (用法) dim instance as gzipstream c # public class gzipstream: stream c + + public ref class gzipstream: public stream j # public class gzipstream extends stream jscript public class gzipstream extends stream 备注 此类表示 gzip 数据格式, 它使用无损压缩和解压缩文件的行业标准算法.这种格式包括一个检测数据损坏的循环冗余校验值.gzip 数据格式使用的算法与 deflatestream 类的算法相同, 但它可以扩展以使用其他压缩格式.这种格式可以通过不涉及专利使用权的方式轻松实现.gzip 的格式可以从 rfc 1952 gzip file format specification 4.3 (gzip 文件格式规范 4.3) gzip file format specification 4.3 (gzip 文件格式规范 4.3) 中获得.此类不能用于压缩大于 4 gb 的文件. 给继承者的说明 当从 gzipstream 继承时, 必须重写下列成员: canseek、canwrite 和 canread. 下面提供 一个完整的压缩与解压类 (downmoon原作): class clszip ... public void compressfile (string sourcefile, string destinationfile) ... / / make sure the source file is there if (file. exists (sourcefile) = = false) throw new filenotfoundexception (); / / create the stream and byte arrays needed byte [] buffer = null; filestream sourcestream = null; filestream destinationstream = null; gzipstream compressedstream = null; try ... / / read the bytes from the source file into a byte array sourcestream = new filestream (sourcefile, filemode. open, fileaccess. read, fileshare. read). / / read the source stream values into the buffer buffer = new byte [sourcestream.length]; int checkcounter = sourcestream. read (buffer, 0, 缓冲区长度); 如果(checkcounter!=缓冲区长度) …{ 把新的applicationexception(); } / /打开文件流写入 destinationstream =新的FILESTREAM(destinationfile,filemode.openorcreate,以及编写); //创建一个压缩流指向destiantion流 compressedstream =新gzipstream(destinationstream,CompressionM

您可能关注的文档

文档评论(0)

f8r9t5c + 关注
实名认证
文档贡献者

该用户很懒,什么也没介绍

版权声明书
用户编号:8000054077000003

1亿VIP精品文档

相关文档