public class ZipBin
    {
        public byte[] bytes;
        //C#读取压缩文件(将压缩文件转换为二进制
        public void GetZipToByte(string inpath)
        {
            FileStream fs = new FileStream(inpath, FileMode.Open);
            bytes = new byte[fs.Length];
            int count = Convert.ToInt32(fs.Length);
            fs.Read(bytes, 0, count);
        }

        //C#将二进制转换为压缩文件
        public void GetByteToZip(string outpath)
        {
            string path = outpath;//压缩文件的地址 
            File.WriteAllBytes(path, bytes);
        }
    }
View Code

 

 posted on 2013-11-06 16:47  aweifly  阅读(563)  评论(0编辑  收藏  举报