- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 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
您可能关注的文档
- 5日式炸豆腐(5 Japanese fried tofu).doc
- 5月16日 营养课复习(Nutrition lessons review in May 16th).doc
- 5血气分析(5 blood gas analysis).doc
- 6-7月-全能型车间主任实战技能训练(6-7 months - versatile workshop director practical skills training).doc
- 6 第六章 常用辅助业务系统(试题)1九隆祥(6, sixth chapters commonly used auxiliary business system (examination questions) 1, nine long Xiang).doc
- 60分钟搭一个全能linux系统(60 minutes to build an all powerful Linux system).doc
- 60年那些消失和新生的词语(60 years words of disappearance and rebirth).doc
- 60天提高400分你也能行!不看后悔(400 points up 60 days, you can do it, do not look at regret).doc
- 60款辅食(60 complementary food).doc
- 57混凝土及抹灰面复层涂料通用施工工艺(57 general construction technology of composite coating for concrete and plastering surface).doc
- net framework 2.0 中新增的两个压缩类(Two new compression classes in net framework 2).doc
- mp3的小常识(Mp3 common sense).doc
- ntfs的兼容8.3格式短文件名(NTFS compatibility 8.3 format short file name).doc
- mysql数据库双向同步(Mysql database bidirectional synchronization).doc
- office办公题(办公室办公题).doc
- oki5100f打印机乱码解决办法(Oki5100f printer garbled solution).doc
- oot装修经验教训(OOT decoration lessons learned).doc
- ohsas与ohsms有什么区别(What's the difference between OHSAS and OHSMS).doc
- ogame殖民星大小(Ogame colonial star size).doc
- opengl画线 虚线 折线(OpenGL画线虚线折线).doc
文档评论(0)