All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
c#生成图片验证码代码_[Asp.Net教程]
不经保存,直接读取上传文件的内容_[Asp.Net教程]
ASP.NET,2.0,WebService中传递DataTable参考_[Asp.Net教程]
经典:用PHP程序控制网页浏览器cache_php资料_编程技术
Apache指南- .htaccess文件使用手册_[PHP教程]
利用.NET绘图技术制作水晶按钮控件_.net资料_编程技术
触发器学习_[SQL Server教程]
C#网络应用编程基础练习题与答案(九)_[Asp.Net教程]
ASP.NET代码拾零_[Asp.Net教程]
ASP.NET2.0服务器控件之创建自定义控件_[Asp.Net教程]
Reading number is top 10 pictures
非笑不可:最强爆笑图片精选
这只猪到底犯了什么错?
So beauty, will let you spray blood6
Go to the national museum3
Beautiful Japanese beauty(漂亮的日本美女)2
陪睡门马睿菈自曝写真 称首拍大尺度照片2
China railway shunting skills competition
关于海盗的研究
Black and white also sexy--YanLiu1
Female model behind the bitterness, often being overcharged1
Download software ranking
Twenty piece of palm leaf
Ashlynn Video4
双旗镇刀客A
Boxer Classic video3
Macromedia Dreamweaver 8
Tram sex maniac 2 (H) rar bag18
Be there or be square
Sora aoi, the nurse, uniform ,nursing assistant
Tram sex maniac 2 (H) rar bag14
The cock of the Grosvenor LTD handsome
aaa published in(发表于) 2013/12/11 8:29:21 Edit(编辑)
ASP.NET技巧:用GZip压缩和解压_.net资料_编程技术

ASP.NET技巧:用GZip压缩和解压_.net资料_编程技术

ASP.NET技巧:用GZip压缩和解压_.net资料_编程技术-你的首页-uuhomepage.com

.Net支持两种压缩格式:GZip和Deflate。我试了一下,压缩率和速度没区别。其中,GZip可以被WinRAR打开。


使用起来很简单,下面的程序将字符串压缩入文件:


using (DeflateStream gzip = new DeflateStream(fs, CompressionMode.Compress))
{
byte[] buf = Encoding.UTF8.GetBytes(this.txbSource.Text);
gzip.Write(buf, 0, buf.Length);
gzip.Flush();
}


解压只需要这样:


gzip = new GZipStream(new MemoryStream(buf), CompressionMode.Decompress);
using (StreamReader reader = new StreamReader(gzip))
{
this.txbTarget.Text = reader.ReadToEnd();
}


如果从文件解压,只需要把MemoryStream换成一个FileStream就行了。
当然,需要加:using System.IO.Compression;






添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.