//
-// System.IO/Stream.cs
+// System.IO.Stream.cs
//
// Authors:
// Dietmar Maurer (dietmar@ximian.com)
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 ();
get;
}
-#if NET_2_0
+ [ComVisible (false)]
public virtual bool CanTimeout {
get {
return false;
}
}
-#endif
public abstract long Length
{
}
-#if NET_2_0
// 2.0 version of Dispose.
public void Dispose ()
{
Dispose (true);
}
+ [ComVisible (false)]
public virtual int ReadTimeout {
get {
throw new InvalidOperationException ("Timeouts are not supported on this stream.");
}
}
+ [ComVisible (false)]
public virtual int WriteTimeout {
get {
throw new InvalidOperationException ("Timeouts are not supported on this stream.");
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);
}
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");
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");
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.");
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.");
{
}
- public override int Read (byte[] buffer,
- int offset,
- int count)
+ public override int Read (byte[] buffer, int offset, int count)
{
return 0;
}
return -1;
}
- public override long Seek (long offset,
- SeekOrigin origin)
+ public override long Seek (long offset, SeekOrigin origin)
{
return 0;
}
{
}
- public override void Write (byte[] buffer,
- int offset,
- int count)
+ public override void Write (byte[] buffer, int offset, int count)
{
}