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


C# GZipStream.Flush方法代码示例

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


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

示例1: FlushFailsAfterDispose

 public void FlushFailsAfterDispose()
 {
     var ms = new MemoryStream();
     var ds = new GZipStream(ms, CompressionMode.Compress);
     ds.Dispose();
     Assert.Throws<ObjectDisposedException>(() => { ds.Flush(); });
 }
开发者ID:Cythical,项目名称:corefx,代码行数:7,代码来源:GZipStreamTests.cs

示例2: Flush

        public async Task Flush()
        {
            var ms = new MemoryStream();
            var ds = new GZipStream(ms, CompressionMode.Compress);
            ds.Flush();
            await ds.FlushAsync();

            // Just ensuring Flush doesn't throw
        }
开发者ID:Cythical,项目名称:corefx,代码行数:9,代码来源:GZipStreamTests.cs

示例3: SerializeCompressedJson

 /// <summary>
 /// Serializes an IBatch to a JSON and compresses it
 /// </summary>
 /// <param name="batch">The IBatch to serialize</param>
 /// <param name="stream">The stream to write the serialized data to</param>
 internal static void SerializeCompressedJson(this IBatch batch, Stream stream)
 {
     using (var gzipStream = new GZipStream(stream, CompressionMode.Compress, true))
     {
         TextWriter textWriter = new StreamWriter(gzipStream);
         textWriter.Write(batch.SerializeToJson());
         textWriter.Flush();
         gzipStream.Flush();
     }
 }
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:15,代码来源:LoggingExtensions.cs

示例4: TestNotSupported

        public void TestNotSupported()
        {
            Stream      baseStream = new MemoryStream(this.compressedData);
            GZipStream  gzipStream = new GZipStream(baseStream, CompressionMode.Decompress);

            try { gzipStream.Write(null, 0, 0); }
            catch (NotSupportedException) {}

            try { gzipStream.Flush(); }
            catch (NotSupportedException) {}

            try { gzipStream.Seek(0, SeekOrigin.Begin); }
            catch (NotSupportedException) {}

            try { gzipStream.SetLength(0); }
            catch (NotSupportedException) {}
        }
开发者ID:nagyist,项目名称:GoogleAnalytics-MonoMac-Demo,代码行数:17,代码来源:gzipstreamtest.cs

示例5: SerializeCompressedXml

 /// <summary>
 /// Serializes an IBatch to a XML and compresses it
 /// </summary>
 /// <param name="batch">The IBatch to serialize</param>
 /// <param name="stream">The stream to write the serialized and compressed data to</param>
 internal static void SerializeCompressedXml(this IBatch batch, Stream stream)
 {
     using (var gzipStream = new GZipStream(stream, CompressionMode.Compress, true))
     {
         batch.SerializeUncompressedXml(gzipStream);
         gzipStream.Flush();
     }
 }
开发者ID:bondarenkod,项目名称:pf-arm-deploy-error,代码行数:13,代码来源:LoggingExtensions.cs


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