Browse Source

Flush a set of pending changes:

2002-02-28  Miguel de Icaza  <[email protected]>

	* Stream.cs (NullStream): Do not track position, this beast does
	nothing in practice.

2002-03-14  Miguel de Icaza  <[email protected]>

	* Array.cs: Add some extra debugging information.

svn path=/trunk/mcs/; revision=3147
Miguel de Icaza 24 years ago
parent
commit
cc2a3182a4

+ 5 - 2
mcs/class/corlib/System.IO/ChangeLog

@@ -1,3 +1,8 @@
+2002-02-28  Miguel de Icaza  <[email protected]>
+
+	* Stream.cs (NullStream): Do not track position, this beast does
+	nothing in practice.
+
 2002-03-15  Dan Lewis <[email protected]>
 
 	* SearchPattern.cs: New class. Glob matching code for Directory.
@@ -20,8 +25,6 @@
 
 	* IOException.cs: Added missing constructors.
 	
-	
-
 2002-03-07  Nick Drochak  <[email protected]>
 
 	* FileMode.cs: Docs don't say this should be explicitly derived from

+ 54 - 34
mcs/class/corlib/System.IO/Stream.cs

@@ -1,24 +1,25 @@
 //
 // System.IO/Stream.cs
 //
-// Author:
+// Authors:
 //   Dietmar Maurer ([email protected])
+//   Miguel de Icaza ([email protected])
 //
-// (C) 2001 Ximian, Inc.  http://www.ximian.com
+// (C) 2001, 2002 Ximian, Inc.  http://www.ximian.com
 //
 
 using System.Threading;
 
 namespace System.IO
 {
-
+	[Serializable]
 	public abstract class Stream : MarshalByRefObject, IDisposable
 	{
-		// public static readonly Stream Null;
+		public static readonly Stream Null;
 
 		static Stream ()
 		{
-			//Null = new NullStream ();
+			Null = new NullStream ();
 		}
 
 		protected Stream ()
@@ -60,10 +61,10 @@ namespace System.IO
 		public virtual void Dispose ()
 		{
 		}
-		
+
 		protected virtual WaitHandle CreateWaitHandle()
 		{
-			return(null);
+			return new ManualResetEvent (false);
 		}
 		
 		protected virtual void Dispose (bool disposing)
@@ -107,13 +108,45 @@ namespace System.IO
 
 			Write (buffer, 0, 1);
 		}
+
+		delegate int ReadDelegate (byte [] buffer, int offset, int count);
+
+		[MonoTODO]
+		public virtual IAsyncResult
+		BeginRead (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+		{
+			if (!CanRead)
+				throw new NotSupportedException ("This stream does not support reading");
+
+			return null;
+		}
+
+		[MonoTODO]
+		public virtual IAsyncResult
+		BeginWrite (byte [] buffer, int offset, int count, AsyncCallback cback, object state)
+		{
+			return null;
+		}
+		
+		[MonoTODO]
+		public virtual int EndRead (IAsyncResult async_result)
+		{
+			if (async_result == null)
+				throw new ArgumentNullException ("async_result");
+			return 0;
+		}
+
+		[MonoTODO]
+		public virtual int EndWrite (IAsyncResult async_result)
+		{
+			if (async_result == null)
+				throw new ArgumentNullException ("async_result");
+			return 0;
+		}
 	}
 
 	class NullStream : Stream
 	{
-                private long position = 0;
-                private long length = System.Int64.MaxValue;
-
 		public override bool CanRead
 		{
 			get {
@@ -138,17 +171,16 @@ namespace System.IO
 		public override long Length
 		{
 			get {
-				return length;
+				return 0;
 			}
 		}
 
 		public override long Position
 		{
 			get {
-				return position;
+				return 0;
 			}
 			set {
-				position = value;
 			}
 		}
 
@@ -160,12 +192,7 @@ namespace System.IO
 					  int offset,
 					  int count)
 		{
-			int max = offset + count;
-			
-			for (int i = offset; i < max; i++)
-				buffer [i] = 0;
-
-			return count;
+			return 0;
 		}
 
 		public override int ReadByte ()
@@ -176,24 +203,11 @@ namespace System.IO
 		public override long Seek (long offset,
 					   SeekOrigin origin)
 		{
-			switch (origin) {
-			case SeekOrigin.Begin:
-				position = offset;
-				break;
-			case SeekOrigin.Current:
-				position = position + offset;
-				break;
-			case SeekOrigin.End:
-				position = Length - offset;
-				break;
-			}
-
-			return position;
+			return 0;
 		}
 
 		public override void SetLength (long value)
 		{
-			length = value;
 		}
 
 		public override void Write (byte[] buffer,
@@ -205,6 +219,12 @@ namespace System.IO
 		public override void WriteByte (byte value)
 		{
 		}
-
 	}
 }
+
+
+
+
+
+
+

+ 1 - 1
mcs/class/corlib/System.Security.Permissions/FileIOPermission.cs

@@ -408,4 +408,4 @@ namespace System.Security.Permissions {
 		}
 
 	}
-}
+}

+ 9 - 6
mcs/class/corlib/System.Threading/ManualResetEvent.cs

@@ -17,18 +17,21 @@ namespace System.Threading
  	public sealed class ManualResetEvent : WaitHandle 
 	{
 		// Constructor
-		public ManualResetEvent(bool initialState) {
-			os_handle = NativeEventCalls.CreateEvent_internal(true,initialState,null);
+		public ManualResetEvent (bool initialState)
+		{
+			os_handle = NativeEventCalls.CreateEvent_internal (true, initialState, null);
 		}
 
 		// Methods
 
-		public bool Set() {
-			return(NativeEventCalls.SetEvent_internal(os_handle));
+		public bool Set()
+		{
+			return (NativeEventCalls.SetEvent_internal (os_handle));
 		}
 
-		public bool Reset() {
-			return(NativeEventCalls.ResetEvent_internal(os_handle));
+		public bool Reset()
+		{
+			return(NativeEventCalls.ResetEvent_internal (os_handle));
 		}
 
 	}

+ 2 - 1
mcs/class/corlib/System/Array.cs

@@ -465,7 +465,8 @@ namespace System
 				    (src_type.Equals (typeof (Object))))
 					throw new InvalidCastException ();
 				else
-					throw new ArrayTypeMismatchException ();
+					throw new ArrayTypeMismatchException (
+						String.Format ("(Types: source={0};  target={1})", src_type.FullName, dst_type.FullName));
 			}
 		}
 		

+ 4 - 0
mcs/class/corlib/System/ChangeLog

@@ -1,3 +1,7 @@
+2002-03-14  Miguel de Icaza  <[email protected]>
+
+	* Array.cs: Add some extra debugging information.
+
 2002-03-15  Nick Drochak  <[email protected]>
 
 	* Array.cs: Added IList and IEnumerable.