mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-23 17:24:46 +03:00
Moved the http server to it's own assembly. added comments and made other minor re-organizations.
This commit is contained in:
parent
6fbd5cf464
commit
80b3ad7bd2
19
MediaBrowser.Net/StreamExtensions.cs
Normal file
19
MediaBrowser.Net/StreamExtensions.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reactive.Linq;
|
||||
|
||||
namespace MediaBrowser.Net
|
||||
{
|
||||
public static class StreamExtensions
|
||||
{
|
||||
public static IObservable<byte[]> ReadBytes(this Stream stream, int count)
|
||||
{
|
||||
var buffer = new byte[count];
|
||||
return Observable.FromAsyncPattern((cb, state) => stream.BeginRead(buffer, 0, count, cb, state), ar =>
|
||||
{
|
||||
stream.EndRead(ar);
|
||||
return buffer;
|
||||
})();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user