20080509 c# zip gzip
http://www.shengfang.org
http://www.techtalkz.com/c-c-sharp/111112-zip-file-using-stream.html
Zip file using a stream
http://www.codeproject.com/KB/dotnet/mscompression.aspx
MemoryStream Compression
http://community.sharpdevelop.net/forums/p/5273/15129.aspx#15129
Compress MemoryStream and what is best method
http://www.pcreview.co.uk/forums/thread-1300944.php
Reply
Zipping and unzipping
http://mastercsharp.com/article.aspx?ArticleID=86&TopicID=16
/ The actual ZIP method
private byte[] Zip(string stringToZip)
{
byte[] inputByteArray = Encoding.UTF8.GetBytes(stringToZip);
MemoryStream ms = new MemoryStream();
// Check the #ziplib docs for more information
ZipOutputStream zipOut = new ZipOutputStream( ms ) ;
ZipEntry ZipEntry = new ZipEntry("ZippedFile");
zipOut.PutNextEntry(ZipEntry);
zipOut.SetLevel(9);
zipOut.Write(inputByteArray, 0 , inputByteArray.Length ) ;
zipOut.Finish();
zipOut.Close();
// Return the zipped contents
return ms.ToArray();
}
http://www.cnblogs.com/shawb/articles/140881.html
在线压缩文件
http://www.w3sky.com/2/2505.html
实时zip压缩下载整个目录
http://community.icsharpcode.net/forums/p/3147/9246.aspx
Creating a Zip containing files with special characters
int转换成长度为4的byte数组,长度为4的byte数组合成一个int.
static int bytes2int(byte[] b)
{
//byte[] b=new byte[]{ 1,2,3,4 };
int mask=0xff;
int temp=0;
int res=0;
for(int i=0;i<4;i++){
res<<=8;
temp=b[i]&mask;
res|=temp;
}
return res;
}
static byte[] int2bytes(int num)
{
byte[] b=new byte[4];
int mask=0xff;
for(int i=0;i<4;i++){
b[i]=(byte)(num>>>(24-i*8));
}
return b;
}
将一个包含ASCII编码字符的Byte数组转化为一个完整的String,可以使用如下的方法:
using System;
using System.Text;
public static string FromASCIIByteArray(byte[] characters)
{
ASCIIEncoding encoding = new ASCIIEncoding( );
string constructedString = encoding.GetString(characters);
return (constructedString);
}
将一个包含Unicode编码字符的Byte数组转化为一个完整的String,可以使用如下的方法:
public static string FromUnicodeByteArray(byte[] characters)
{
UnicodeEncoding encoding = new UnicodeEncoding( );
string constructedString = encoding.GetString(characters);
return (constructedString);
}
http://skyivben.cnblogs.com/archive/2005/09/17/238828.html
使用C#2.0进行文件压缩和解压
http://www.cnblogs.com/jeet/default.html?page=5
压缩数据,提升Web service性能
http://www.hackhome.com/InfoView/Article_8519_2.html
在C#中利用SharpZipLib进行文件的压缩和解压缩
http://www.w3sky.com/2/2505.html
实时zip压缩下载整个目录
http://www.winimage.com/zLibDll/minizip.html
Minizip: Zip and UnZip additionnal library
http://www.codeproject.com/KB/files/sharpzlib.aspx
#zlib - Modifying Archives
http://www.vbfrance.com/codes/ZLIB-NET-COMPRESSION-ZIP-AVEC-VB-NET_46397.aspx
ZLIB.NET : COMPRESSION ZIP AVEC VB.NET
http://www.cnblogs.com/Magicsky/archive/2007/07/08/810274.html
不依赖OFFICE组件实现带图片的EXCEL导出
文件下载时用的Http头
HttpResponse.AddHeader("content-disposition", "attachment;filename=" + filename)