首页 Soft PlugIn RAN乱 Dev开发 Info资料 English WAP 留言 登陆 注册
-
Posted by Yippee | 评论(0) | 引用(0) | 阅读118次
20080509 c# zip gzip

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)


字体:


Permanant URI永久地址 http://www.shengfang.org/blog/p/20080509csharpzipgzip.php
Trackback URI引用地址 http://www.shengfang.org/blog/tb.php?tb_id=1232902431

2009年1月26日00:53星期一  [Dev开发] 追踪此文的RSS
提示:
此文还没有评论。

称呼:    登陆   注册
   不注册,但记住我的信息
邮件:
(非必须)
评论: [UBB代码帮助]
粗体 斜体 下划线 链接 水平线 引用



验证码: 请输入你看见的数字
关闭UBB      提交时自动将内容复制到剪贴板

公告
Fire and Motion!

统计信息
[Yippee]||[统计]||日志:1790
在线: 12||用户: 2562 [列表]
今日:2361||到访:2677177
Rss:840223||评论:1584

最新日志

最新评论

友情链接

日历

最新引用

搜索

归档

杂项
Get RSS Feed (Version 2.0)
Get Atom Feed (Version 0.3)
编码:  UTF-8