当前位置: 首页>>代码示例>>C#>>正文


C# System.IO.Compression.GZipStream.Flush方法代码示例

本文整理汇总了C#中System.IO.Compression.GZipStream.Flush方法的典型用法代码示例。如果您正苦于以下问题:C# System.IO.Compression.GZipStream.Flush方法的具体用法?C# System.IO.Compression.GZipStream.Flush怎么用?C# System.IO.Compression.GZipStream.Flush使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.Compression.GZipStream的用法示例。


在下文中一共展示了System.IO.Compression.GZipStream.Flush方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Compress

        /// <summary>
        /// Compress with Stream
        /// </summary>
        public static void Compress(Stream input)
        {
            System.IO.Compression.GZipStream stream =
                new System.IO.Compression.GZipStream(
                    input, System.IO.Compression.CompressionMode.Compress, true);

            stream.Flush();
        }
开发者ID:tianjing,项目名称:Packages,代码行数:11,代码来源:GzipHelper.cs

示例2: UnGZIP

        public static string UnGZIP(ref byte[] input)
        {
            System.IO.MemoryStream oMemoryStream = null;
            System.IO.Compression.GZipStream oGZipStream = null;
            int iLength = 0;
            byte[] byteArray = new byte[100001];
            System.Text.StringBuilder oStringBuilder = new System.Text.StringBuilder();

            oMemoryStream = new System.IO.MemoryStream(input);
            oGZipStream = new System.IO.Compression.GZipStream(oMemoryStream, System.IO.Compression.CompressionMode.Decompress);
            oMemoryStream.Flush();
            oGZipStream.Flush();
            do
            {
                iLength = oGZipStream.Read(byteArray, 0, byteArray.Length);
                if (iLength < 1)
                    break; // TODO: might not be correct. Was : Exit Do
                oStringBuilder.Append(System.Text.Encoding.UTF8.GetString(byteArray, 0, iLength));
            } while (true);
            oGZipStream.Close();
            oMemoryStream.Close();
            oGZipStream.Dispose();
            oMemoryStream.Dispose();
            return oStringBuilder.ToString();
        }
开发者ID:phuongdesti,项目名称:color,代码行数:25,代码来源:Utility.cs

示例3: Save

        public void Save(string path)
        {
            if (!System.IO.Directory.Exists(path))
                System.IO.Directory.CreateDirectory(path);

            System.IO.FileStream fs = new System.IO.FileStream(GetFilePath(path, this.CategoryName), System.IO.FileMode.Create);
            System.IO.Compression.GZipStream gz = new System.IO.Compression.GZipStream(fs, System.IO.Compression.CompressionMode.Compress);

            ProtoBuf.Serializer.PrepareSerializer<CompositionCategory>();

            ProtoBuf.Serializer.Serialize(gz, this);

            gz.Flush();

            gz.Close();

            fs.Close();
        }
开发者ID:stefan-j,项目名称:DotNetMusic,代码行数:18,代码来源:CompositionCategory.cs


注:本文中的System.IO.Compression.GZipStream.Flush方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。