X-Git-Url: http://wien.tomnetworks.com/gitweb/?a=blobdiff_plain;f=mcs%2Fclass%2Fcorlib%2FSystem.IO%2FStream.cs;h=d6e0359a86713b8a913ee9e47ef0c26ca95d9569;hb=3c39ac4586b4470703fb4af0208b5baf1de70e43;hp=6c1fa4c01800f4c00cdd275e4e42e653eb4faa8d;hpb=1c14f1ee6d701510c15499d71fc2b324151a8629;p=mono.git diff --git a/mcs/class/corlib/System.IO/Stream.cs b/mcs/class/corlib/System.IO/Stream.cs index 6c1fa4c0180..d6e0359a867 100644 --- a/mcs/class/corlib/System.IO/Stream.cs +++ b/mcs/class/corlib/System.IO/Stream.cs @@ -1,5 +1,5 @@ // -// System.IO/Stream.cs +// System.IO.Stream.cs // // Authors: // Dietmar Maurer (dietmar@ximian.com) @@ -40,7 +40,12 @@ using System.Runtime.InteropServices; namespace System.IO { [Serializable] + [ComVisible (true)] +#if NET_2_1 + public abstract class Stream : IDisposable +#else public abstract class Stream : MarshalByRefObject, IDisposable +#endif { public static readonly Stream Null = new NullStream (); @@ -63,13 +68,12 @@ namespace System.IO get; } -#if NET_2_0 + [ComVisible (false)] public virtual bool CanTimeout { get { return false; } } -#endif public abstract long Length { @@ -83,7 +87,6 @@ namespace System.IO } -#if NET_2_0 // 2.0 version of Dispose. public void Dispose () { @@ -104,6 +107,7 @@ namespace System.IO Dispose (true); } + [ComVisible (false)] public virtual int ReadTimeout { get { throw new InvalidOperationException ("Timeouts are not supported on this stream."); @@ -113,6 +117,7 @@ namespace System.IO } } + [ComVisible (false)] public virtual int WriteTimeout { get { throw new InvalidOperationException ("Timeouts are not supported on this stream."); @@ -121,19 +126,13 @@ namespace System.IO throw new InvalidOperationException ("Timeouts are not supported on this stream."); } } -#else - // 1.1 version of Close - public virtual void Close () - { - // nothing - } -#endif - void IDisposable.Dispose () + public static Stream Synchronized (Stream stream) { - Close (); + throw new NotImplementedException (); } + [Obsolete ("CreateWaitHandle is due for removal. Use \"new ManualResetEvent(false)\" instead.")] protected virtual WaitHandle CreateWaitHandle() { return new ManualResetEvent (false); @@ -169,7 +168,7 @@ namespace System.IO } public virtual IAsyncResult - BeginRead (byte [] buffer, int offset, int count, AsyncCallback cback, object state) + BeginRead (byte [] buffer, int offset, int count, AsyncCallback callback, object state) { if (!CanRead) throw new NotSupportedException ("This stream does not support reading"); @@ -190,16 +189,16 @@ namespace System.IO result.SetComplete (e, 0); } - if (cback != null) - cback (result); + if (callback != null) + callback (result); return result; } - delegate void WriteDelegate (byte [] buffer, int offset, int count); +// delegate void WriteDelegate (byte [] buffer, int offset, int count); public virtual IAsyncResult - BeginWrite (byte [] buffer, int offset, int count, AsyncCallback cback, object state) + BeginWrite (byte [] buffer, int offset, int count, AsyncCallback callback, object state) { if (!CanWrite) throw new NotSupportedException ("This stream does not support writing"); @@ -220,20 +219,20 @@ namespace System.IO result.SetComplete (e); } - if (cback != null) - cback.BeginInvoke (result, null, null); + if (callback != null) + callback.BeginInvoke (result, null, null); return result; } - public virtual int EndRead (IAsyncResult async_result) + public virtual int EndRead (IAsyncResult asyncResult) { - if (async_result == null) - throw new ArgumentNullException ("async_result"); + if (asyncResult == null) + throw new ArgumentNullException ("asyncResult"); - StreamAsyncResult result = async_result as StreamAsyncResult; + StreamAsyncResult result = asyncResult as StreamAsyncResult; if (result == null || result.NBytes == -1) - throw new ArgumentException ("Invalid IAsyncResult", "async_result"); + throw new ArgumentException ("Invalid IAsyncResult", "asyncResult"); if (result.Done) throw new InvalidOperationException ("EndRead already called."); @@ -245,14 +244,14 @@ namespace System.IO return result.NBytes; } - public virtual void EndWrite (IAsyncResult async_result) + public virtual void EndWrite (IAsyncResult asyncResult) { - if (async_result == null) - throw new ArgumentNullException ("async_result"); + if (asyncResult == null) + throw new ArgumentNullException ("asyncResult"); - StreamAsyncResult result = async_result as StreamAsyncResult; + StreamAsyncResult result = asyncResult as StreamAsyncResult; if (result == null || result.NBytes != -1) - throw new ArgumentException ("Invalid IAsyncResult", "async_result"); + throw new ArgumentException ("Invalid IAsyncResult", "asyncResult"); if (result.Done) throw new InvalidOperationException ("EndWrite already called."); @@ -306,9 +305,7 @@ namespace System.IO { } - public override int Read (byte[] buffer, - int offset, - int count) + public override int Read (byte[] buffer, int offset, int count) { return 0; } @@ -318,8 +315,7 @@ namespace System.IO return -1; } - public override long Seek (long offset, - SeekOrigin origin) + public override long Seek (long offset, SeekOrigin origin) { return 0; } @@ -328,9 +324,7 @@ namespace System.IO { } - public override void Write (byte[] buffer, - int offset, - int count) + public override void Write (byte[] buffer, int offset, int count) { }