* AttributeUseage.cs: Should define AttributeUsageAttribute.
[mono.git] / mcs / class / corlib / System.IO / StringReader.cs
index 8922c51acaa408f283a850bae2d376eba80c70d7..713327a37973e3f0768efe039d77e8bdd9d1a7da 100644 (file)
@@ -53,8 +53,16 @@ namespace System.IO {
                // the actual number of characters read, or zero if the end of the string \r
                // has been reached and no characters are read.\r
 \r
-               public override int Read( out char[] buffer, int index, int count ) {\r
-                       \r
+               public override int Read( char[] buffer, int index, int count ) {\r
+\r
+                       if( buffer == null ) {\r
+                               throw new ArgumentNullException();\r
+                       } else if( buffer.Length - index < count ) {\r
+                               throw new ArgumentException(); \r
+                       } else if( index < 0 || count < 0 ) {\r
+                               throw new ArgumentOutOfRangeException();\r
+                       }\r
+\r
                        int charsToRead;\r
 \r
                        if( nextChar + count > sourceLength ) {\r
@@ -62,8 +70,6 @@ namespace System.IO {
                        } else {\r
                                charsToRead = count;\r
                        }\r
-                       \r
-                       buffer = new char [charsToRead];\r
 \r
                        Array.Copy(sourceChars, nextChar, buffer, index, charsToRead );\r
 \r