StaticRemoteStreamWriter.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. using MediaBrowser.Common.Net;
  2. using ServiceStack.Web;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. namespace MediaBrowser.Api.Playback
  6. {
  7. /// <summary>
  8. /// Class StaticRemoteStreamWriter
  9. /// </summary>
  10. public class StaticRemoteStreamWriter : IStreamWriter, IHasOptions
  11. {
  12. /// <summary>
  13. /// The _input stream
  14. /// </summary>
  15. private readonly HttpResponseInfo _response;
  16. /// <summary>
  17. /// The _options
  18. /// </summary>
  19. private readonly IDictionary<string, string> _options = new Dictionary<string, string>();
  20. public StaticRemoteStreamWriter(HttpResponseInfo response)
  21. {
  22. _response = response;
  23. }
  24. /// <summary>
  25. /// Gets the options.
  26. /// </summary>
  27. /// <value>The options.</value>
  28. public IDictionary<string, string> Options
  29. {
  30. get { return _options; }
  31. }
  32. /// <summary>
  33. /// Writes to.
  34. /// </summary>
  35. /// <param name="responseStream">The response stream.</param>
  36. public void WriteTo(Stream responseStream)
  37. {
  38. using (_response)
  39. {
  40. _response.Content.CopyTo(responseStream, 819200);
  41. }
  42. }
  43. }
  44. }