当前位置:编程学习 > asp >>

GZip解压.NET代码

public static byte[] GZipDecompress(Byte[] bytes)
        {
            BinaryReader br = null;
            System.IO.Compression.GZipStream dcmp = null;

            try
            {
                using (MemoryStream ms = new MemoryStream(bytes))
                {
                    dcmp = new System.IO.Compression.GZipStream(ms, System.IO.Compression.CompressionMode.Decompress);
                    br = new BinaryReader(dcmp);
                    return br.ReadBytes((int)dcmp.Length);
                }
            }
            catch (System.Exception e)
            {

            }
            finally
            {
                br.Close();
                dcmp.Close();
            }
           
            return bytes;
        }
 

 

摘自 appleII的博客
补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,