惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
月光博客
月光博客
WordPress大学
WordPress大学
C
Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
博客园 - 【当耐特】
大猫的无限游戏
大猫的无限游戏
The GitHub Blog
The GitHub Blog
Google DeepMind News
Google DeepMind News
The Cloudflare Blog
有赞技术团队
有赞技术团队
Microsoft Azure Blog
Microsoft Azure Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
小众软件
小众软件
H
Heimdal Security Blog
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
W
WeLiveSecurity
量子位
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
F
Fortinet All Blogs
T
Threat Research - Cisco Blogs
Attack and Defense Labs
Attack and Defense Labs
P
Privacy & Cybersecurity Law Blog
D
Darknet – Hacking Tools, Hacker News & Cyber Security
NISL@THU
NISL@THU
Forbes - Security
Forbes - Security
L
Lohrmann on Cybersecurity
C
CERT Recently Published Vulnerability Notes
L
LINUX DO - 热门话题
Google Online Security Blog
Google Online Security Blog
S
Security Affairs
V2EX - 技术
V2EX - 技术
TaoSecurity Blog
TaoSecurity Blog
N
News and Events Feed by Topic
N
News | PayPal Newsroom
S
Security @ Cisco Blogs
宝玉的分享
宝玉的分享
Project Zero
Project Zero
The Hacker News
The Hacker News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
PCI Perspectives
PCI Perspectives
G
GRAHAM CLULEY
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Y
Y Combinator Blog
N
Netflix TechBlog - Medium
S
Schneier on Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园 - 聂微东

博客园 - 痞子再

介绍50个 WordPress 动作挂钩 决定如何开发你的WordPress主题框架 WordPress 主题框架是如何工作的 WordPress主题制作教程[壹] - 了解WP&结构&索引 jQuery UI Datepicker -- jQuery日历控件中的精品(UI绚丽) godaddy.com免费10G空间申请步骤详解 godaddy免费空间完美安装部署dedecms UrlRewriter使用详解 - 痞子再 - 博客园 google的CDN内容分发网络来加载jQuery库 - 痞子再 - 博客园 利用google API实现全文翻译的Web Service JavaScript模拟进度条 字符串操作类 NET代码积累之一 让visual studio 2005 自动为类加版权 C#日期格式化 UrlRewriter 使用详解 (Friendly Url) web.config中配置字符串中特殊字符的处理 - 痞子再 - 博客园 漂浮层广告代码[层为隐藏,点击广告后层消失][24小时/次] 网页采集时,常用的几种正则表达式 C# Check is No number - 痞子再
压缩和解压缩的方法 from Byte[]
痞子再 · 2008-11-21 · via 博客园 - 痞子再

  public static byte[] Zip(byte[] data)
        {
            MemoryStream mstream = new MemoryStream();
            BZip2OutputStream zipOutStream = new BZip2OutputStream(mstream);
            zipOutStream.Write(data, 0, data.Length);
            zipOutStream.Finalize();
            zipOutStream.Close();

            byte[] result = mstream.ToArray();
            mstream.Close();

            return result;
        }

        public static byte[] Unzip(byte[] data)
        {
            MemoryStream mstream = new MemoryStream(data);
            BZip2InputStream zipInputStream = new BZip2InputStream(mstream);
            byte[] byteUncompressed = new byte[zipInputStream.Length];
            zipInputStream.Read(byteUncompressed, 0, (int)byteUncompressed.Length);

            zipInputStream.Close();
            mstream.Close();

            return byteUncompressed;
        }