// 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
} else {\r
charsToRead = count;\r
}\r
- \r
- buffer = new char [charsToRead];\r
\r
Array.Copy(sourceChars, nextChar, buffer, index, charsToRead );\r
\r