返回首页

使用gzip文件的大小:!|您好,
丝毫不差说,每一件事情,我试图压缩和增加文件的大小与代码的打击,但它大小(500MB到950mb!!)
代码:

                 byte[] buffer = new byte[1];

                                sread = new System.IO.FileStream(@"C:\Users\mm\Desktop\code.txt", System.IO.FileMode.Open, System.IO.FileAccess.Read);

                                swrite = new System.IO.FileStream(@"C:\Users\mm\Desktop\0.txt", System.IO.FileMode.Create, System.IO.FileAccess.Write);

 

                                System.IO.Compression.GZipStream g = new     System.IO.Compression.GZipStream(swrite, System.IO.Compression.CompressionMode.Compress,true);

 

            br = new System.IO.BinaryReader(sread);

            bw = new System.IO.BinaryWriter(swrite);

            while (true)

            {

                try

                {

                    buffer= br.ReadBytes(1);

                    g.Write(buffer, 0, 1);

                }

                catch { break; }

            }

            sread.Close();

            swrite.Close();

            br.Close();

            bw.Close();

我怎样才能正确?
谢谢。| mehdi_k

回答