aboutsummaryrefslogtreecommitdiff
path: root/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-07-01 12:24:26 -0400
committerGitHub <noreply@github.com>2017-07-01 12:24:26 -0400
commitff3713153ad2317e1c196f33ac2cba61b449a00e (patch)
tree84d2e6ed5bcb556a2395603b6403c8e992535e6b /Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs
parentfad71a6c7d12c8b207cdf473c7dd7daafa53c174 (diff)
parent2dcad6b5977f5c5be81b18c42506ed8ad3fb73b6 (diff)
Merge pull request #2739 from MediaBrowser/beta
Beta
Diffstat (limited to 'Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs')
-rw-r--r--Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs140
1 files changed, 74 insertions, 66 deletions
diff --git a/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs b/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs
index 0e6189f0c..1804d6745 100644
--- a/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs
+++ b/Emby.Common.Implementations/IO/SharpCifs/Util/Sharpen/OutputStream.cs
@@ -4,83 +4,91 @@ using System.IO;
namespace SharpCifs.Util.Sharpen
{
public class OutputStream : IDisposable
- {
- protected Stream Wrapped;
+ {
+ protected Stream Wrapped;
- public static implicit operator OutputStream (Stream s)
- {
- return Wrap (s);
- }
+ public static implicit operator OutputStream(Stream s)
+ {
+ return Wrap(s);
+ }
- public static implicit operator Stream (OutputStream s)
- {
- return s.GetWrappedStream ();
- }
-
- public virtual void Close ()
- {
- if (Wrapped != null) {
+ public static implicit operator Stream(OutputStream s)
+ {
+ return s.GetWrappedStream();
+ }
+
+ public virtual void Close()
+ {
+ if (Wrapped != null)
+ {
//Stream.`Close` method deleted
//Wrapped.Close ();
Wrapped.Dispose();
}
- }
+ }
- public void Dispose ()
- {
- Close ();
- }
+ public void Dispose()
+ {
+ Close();
+ }
- public virtual void Flush ()
- {
- if (Wrapped != null) {
- Wrapped.Flush ();
- }
- }
+ public virtual void Flush()
+ {
+ if (Wrapped != null)
+ {
+ Wrapped.Flush();
+ }
+ }
- internal Stream GetWrappedStream ()
- {
- // Always create a wrapper stream (not directly Wrapped) since the subclass
- // may be overriding methods that need to be called when used through the Stream class
- return new WrappedSystemStream (this);
- }
+ internal Stream GetWrappedStream()
+ {
+ // Always create a wrapper stream (not directly Wrapped) since the subclass
+ // may be overriding methods that need to be called when used through the Stream class
+ return new WrappedSystemStream(this);
+ }
- static internal OutputStream Wrap (Stream s)
- {
- OutputStream stream = new OutputStream ();
- stream.Wrapped = s;
- return stream;
- }
+ static internal OutputStream Wrap(Stream s)
+ {
+ OutputStream stream = new OutputStream();
+ stream.Wrapped = s;
+ return stream;
+ }
- public virtual void Write (int b)
- {
- if (Wrapped is WrappedSystemStream)
- ((WrappedSystemStream)Wrapped).OutputStream.Write (b);
- else {
- if (Wrapped == null)
- throw new NotImplementedException ();
- Wrapped.WriteByte ((byte)b);
- }
- }
+ public virtual void Write(int b)
+ {
+ if (Wrapped is WrappedSystemStream)
+ ((WrappedSystemStream)Wrapped).OutputStream.Write(b);
+ else
+ {
+ if (Wrapped == null)
+ throw new NotImplementedException();
+ Wrapped.WriteByte((byte)b);
+ }
+ }
- public virtual void Write (byte[] b)
- {
- Write (b, 0, b.Length);
- }
+ public virtual void Write(byte[] b)
+ {
+ Write(b, 0, b.Length);
+ }
- public virtual void Write (byte[] b, int offset, int len)
- {
- if (Wrapped is WrappedSystemStream)
- ((WrappedSystemStream)Wrapped).OutputStream.Write (b, offset, len);
- else {
- if (Wrapped != null) {
- Wrapped.Write (b, offset, len);
- } else {
- for (int i = 0; i < len; i++) {
- Write (b[i + offset]);
- }
- }
- }
- }
- }
+ public virtual void Write(byte[] b, int offset, int len)
+ {
+ if (Wrapped is WrappedSystemStream)
+ ((WrappedSystemStream)Wrapped).OutputStream.Write(b, offset, len);
+ else
+ {
+ if (Wrapped != null)
+ {
+ Wrapped.Write(b, offset, len);
+ }
+ else
+ {
+ for (int i = 0; i < len; i++)
+ {
+ Write(b[i + offset]);
+ }
+ }
+ }
+ }
+ }
}