using ServiceStack.Service;
using System.IO;
using System.Threading.Tasks;
namespace MediaBrowser.Server.Implementations.HttpServer
{
///
/// Class StreamWriter
///
public class StreamWriter : IStreamWriter
{
///
/// Gets or sets the source stream.
///
/// The source stream.
public Stream SourceStream { get; set; }
///
/// Initializes a new instance of the class.
///
/// The source.
public StreamWriter(Stream source)
{
SourceStream = source;
}
///
/// Writes to.
///
/// The response stream.
public void WriteTo(Stream responseStream)
{
var task = WriteToAsync(responseStream);
Task.WaitAll(task);
}
///
/// Writes to async.
///
/// The response stream.
/// Task.
private Task WriteToAsync(Stream responseStream)
{
return SourceStream.CopyToAsync(responseStream);
}
}
}