//\r
// System.IO.StringWriter\r
//\r
-// Authors
-// Marcin Szczepanski (marcins@zipworld.com.au)
-// Sebastien Pouliot <sebastien@ximian.com>
-//
+// Authors\r
+// Marcin Szczepanski (marcins@zipworld.com.au)\r
+// Sebastien Pouliot <sebastien@ximian.com>\r
+//\r
// Copyright (C) 2004 Novell (http://www.novell.com)\r
//\r
-
-//
-// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
-//
-// Permission is hereby granted, free of charge, to any person obtaining
-// a copy of this software and associated documentation files (the
-// "Software"), to deal in the Software without restriction, including
-// without limitation the rights to use, copy, modify, merge, publish,
-// distribute, sublicense, and/or sell copies of the Software, and to
-// permit persons to whom the Software is furnished to do so, subject to
-// the following conditions:
-//
-// The above copyright notice and this permission notice shall be
-// included in all copies or substantial portions of the Software.
-//
-// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-//
-
+\r
+//\r
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
+//\r
+\r
using System.Globalization;\r
using System.Text;\r
\r
+#if NET_2_0\r
+using System.Runtime.InteropServices;\r
+#endif\r
+\r
namespace System.IO {\r
-
+\r
[Serializable]\r
- [MonoTODO ("Fix serialization compatibility with MS.NET")]\r
+#if NET_2_0\r
+ [ComVisible (true)]\r
+#endif\r
+ [MonoTODO ("Serialization format not compatible with .NET")]\r
public class StringWriter : TextWriter {\r
\r
private StringBuilder internalString;\r
private bool disposed = false;\r
\r
- public StringWriter () : this (new StringBuilder ())
- {
+ public StringWriter () : this (new StringBuilder ())\r
+ {\r
}\r
\r
- public StringWriter (IFormatProvider formatProvider) :
- this (new StringBuilder (), formatProvider)
- {
+ public StringWriter (IFormatProvider formatProvider) :\r
+ this (new StringBuilder (), formatProvider)\r
+ {\r
}\r
\r
- public StringWriter (StringBuilder sb) :
- this (sb, null)
+ public StringWriter (StringBuilder sb) :\r
+ this (sb, null)\r
{\r
}\r
\r
- public StringWriter (StringBuilder sb, IFormatProvider formatProvider)
+ public StringWriter (StringBuilder sb, IFormatProvider formatProvider)\r
{\r
if (sb == null)\r
throw new ArgumentNullException ("sb");\r
}\r
}\r
\r
- public override void Close ()
+ public override void Close ()\r
{\r
Dispose (true);\r
disposed = true;\r
disposed = true;\r
}\r
\r
- public virtual StringBuilder GetStringBuilder ()
+ public virtual StringBuilder GetStringBuilder ()\r
{\r
return internalString;\r
}\r
\r
- public override string ToString ()
+ public override string ToString ()\r
{\r
return internalString.ToString ();\r
}\r
\r
- public override void Write (char value)
+ public override void Write (char value)\r
{\r
if (disposed) {\r
- throw new ObjectDisposedException ("StringReader",
- Locale.GetText ("Cannot write to a closed StringWriter"));
+ throw new ObjectDisposedException ("StringReader", \r
+ Locale.GetText ("Cannot write to a closed StringWriter"));\r
}\r
\r
internalString.Append (value);\r
}\r
\r
- public override void Write (string value)
+ public override void Write (string value)\r
{\r
if (disposed) {\r
- throw new ObjectDisposedException ("StringReader",
- Locale.GetText ("Cannot write to a closed StringWriter"));
+ throw new ObjectDisposedException ("StringReader", \r
+ Locale.GetText ("Cannot write to a closed StringWriter"));\r
}\r
-
+\r
internalString.Append (value);\r
}\r
\r
- public override void Write (char[] buffer, int index, int count)
+ public override void Write (char[] buffer, int index, int count)\r
{\r
if (disposed) {\r
- throw new ObjectDisposedException ("StringReader",
- Locale.GetText ("Cannot write to a closed StringWriter"));
+ throw new ObjectDisposedException ("StringReader", \r
+ Locale.GetText ("Cannot write to a closed StringWriter"));\r
}\r
if (buffer == null)\r
- throw new ArgumentNullException ("buffer");
+ throw new ArgumentNullException ("buffer");\r
if (index < 0)\r
- throw new ArgumentOutOfRangeException ("index", "< 0");
+ throw new ArgumentOutOfRangeException ("index", "< 0");\r
if (count < 0)\r
- throw new ArgumentOutOfRangeException ("count", "< 0");
- // re-ordered to avoid possible integer overflow
+ throw new ArgumentOutOfRangeException ("count", "< 0");\r
+ // re-ordered to avoid possible integer overflow\r
if (index > buffer.Length - count)\r
throw new ArgumentException ("index + count > buffer.Length");\r
-
+\r
internalString.Append (buffer, index, count);\r
}\r
}\r