本文整理汇总了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();
}
}
示例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();
}
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}
示例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();
}