* roottypes.cs: Rename from tree.cs.
[mono.git] / mcs / class / corlib / System.IO / StreamReader.cs
index 0e829bdabb29dae92c9668bb49f43ff36df8702c..13246bf916dc624c3a04d9864209c47edd61393f 100644 (file)
@@ -216,6 +216,12 @@ namespace System.IO {
                        }
                }
 
+#if NET_2_0
+               public bool EndOfStream {
+                       get { return Peek () < 0; }
+               }
+#endif
+
                public override void Close ()
                {
                        Dispose (true);
@@ -420,7 +426,7 @@ namespace System.IO {
                                if (foundCR) // don't include the trailing CR if present
                                        decoded_count--;
 
-                               line_builder.Append (new string (decoded_buffer, begin, decoded_count - begin));
+                               line_builder.Append (decoded_buffer, begin, decoded_count - begin);
                                if (ReadBuffer () == 0) {
                                        if (line_builder.Capacity > 32768) {
                                                StringBuilder sb = line_builder;
@@ -433,7 +439,7 @@ namespace System.IO {
                                begin = pos;
                                end = FindNextEOL ();
                                if (end < decoded_count && end >= begin) {
-                                       line_builder.Append (new string (decoded_buffer, begin, end - begin));
+                                       line_builder.Append (decoded_buffer, begin, end - begin);
                                        if (line_builder.Capacity > 32768) {
                                                StringBuilder sb = line_builder;
                                                line_builder = null;
@@ -455,7 +461,7 @@ namespace System.IO {
                        char [] buffer = new char [size];
                        int len;
                        
-                       while ((len = Read (buffer, 0, size)) != 0)
+                       while ((len = Read (buffer, 0, size)) > 0)
                                text.Append (buffer, 0, len);
 
                        return text.ToString ();