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


C# FileStream.WriteTo方法代码示例

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


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

示例1: WriteTo

 public void WriteTo(Stream stream)
 {
     using (var fs = new FileStream(this.FilePath, FileMode.Open, FileAccess.Read))
     {
         fs.WriteTo(stream);
         stream.Flush();
     }
 }
开发者ID:EvgeniyProtas,项目名称:servicestack,代码行数:8,代码来源:FileResult.cs

示例2: WriteTo

        public void WriteTo(Stream responseStream)
        {
            using (var fs = new FileStream(this.FilePath, FileMode.Open, FileAccess.Read))
            {
                fs.Position = Adler32ChecksumLength;

                fs.WriteTo(responseStream);
                responseStream.Flush();
            }
        }
开发者ID:jmaucher,项目名称:SStack,代码行数:10,代码来源:CompressedFileResult.cs

示例3: WriteFile

		public static void WriteFile(this IHttpResponse httpRes, string filePath)
		{
			var aspNetRes = httpRes as HttpResponseWrapper;
			if (aspNetRes != null)
			{
				aspNetRes.Response.WriteFile(filePath);
				return;
			}

			using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
			{
				fs.WriteTo(httpRes.OutputStream);
			}

            httpRes.EndServiceStackRequest();
        }
开发者ID:grammarware,项目名称:fodder,代码行数:16,代码来源:src_ServiceStack_ServiceHost_HttpResponseExtensions.cs

示例4: TransmitFile

        public static void TransmitFile(this IResponse httpRes, string filePath)
		{
			var aspNetRes = httpRes as AspNetResponse;
			if (aspNetRes != null)
			{
				aspNetRes.Response.TransmitFile(filePath);
				return;
			}

			using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
			{
				fs.WriteTo(httpRes.OutputStream);
			}

            httpRes.EndRequest();
        }
开发者ID:GDBSD,项目名称:ServiceStack,代码行数:16,代码来源:HttpResponseExtensions.cs

示例5: TransmitFile

        public static void TransmitFile(this IHttpResponse httpRes, string filePath)
        {
            var aspNetRes = httpRes as HttpResponseWrapper;
            if (aspNetRes != null)
            {
                aspNetRes.Response.TransmitFile(filePath);
                return;
            }

            using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                fs.WriteTo(httpRes.OutputStream);
            }

            //httpRes.Close();
        }
开发者ID:nigthwatch,项目名称:ServiceStack,代码行数:16,代码来源:HttpResponseExtensions.cs

示例6: WriteFile

        public static void WriteFile(this IResponse httpRes, string filePath)
        {
#if !NETSTANDARD1_6
            var aspNetRes = httpRes as ServiceStack.Host.AspNet.AspNetResponse;
            if (aspNetRes != null)
            {
                aspNetRes.Response.WriteFile(filePath);
                return;
            }
#endif

            using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                fs.WriteTo(httpRes.OutputStream);
            }

            httpRes.EndRequest();
        }
开发者ID:AVee,项目名称:ServiceStack,代码行数:18,代码来源:HttpResponseExtensions.cs

示例7: WriteFile

        public static void WriteFile(this IHttpResponse httpRes, string filePath)
        {
            var aspNetRes = httpRes as HttpResponseWrapper;
            if (aspNetRes != null)
            {
                aspNetRes.Response.WriteFile(filePath);
                return;
            }

            using (var fs = new FileStream(filePath, FileMode.Open, FileAccess.Read))
            {
                fs.WriteTo(httpRes.OutputStream);
            }

            ServiceStack.WebHost.Endpoints.EndpointHost.AddGlobalResponseHeaders(httpRes);
            httpRes.Close();
        }
开发者ID:assaframan,项目名称:ServiceStack,代码行数:17,代码来源:HttpResponseExtensions.cs


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