//\r
// (C) Ximian, Inc. http://www.ximian.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
using System.Text;\r
using System;\r
else\r
mode = FileMode.Create;\r
\r
- internalStream = new FileStream (path, mode, FileAccess.Write);\r
+ internalStream = new FileStream (path, mode, FileAccess.Write, FileShare.Read);\r
\r
if (append)\r
internalStream.Position = internalStream.Length;\r
get {\r
return iflush;\r
}\r
- set {\r
- if (DisposedAlready)\r
- throw new ObjectDisposedException("StreamWriter");\r
- iflush = value;\r
- }\r
- }\r
+ set {
+ if (DisposedAlready)
+ throw new ObjectDisposedException("StreamWriter");
+ iflush = value;
+
+ if (iflush) {
+ Flush ();
+ }
+ }
+ }
\r
public virtual Stream BaseStream {\r
get {\r
index += todo;\r
decode_pos += todo;\r
}\r
+ }
+
+ void LowLevelWrite (string s)
+ {
+ int count = s.Length;
+ int index = 0;
+ while (count > 0) {
+ int todo = decode_buf.Length - decode_pos;
+ if (todo == 0) {
+ Decode ();
+ todo = decode_buf.Length;
+ }
+ if (todo > count)
+ todo = count;
+
+ for (int i = 0; i < todo; i ++)
+ decode_buf [i + decode_pos] = s [i + index];
+
+ count -= todo;
+ index += todo;
+ decode_pos += todo;
+ }
}\r
\r
public override void Write (char value)\r
throw new ObjectDisposedException("StreamWriter");\r
\r
if (value != null)\r
- LowLevelWrite (value.ToCharArray (), 0, value.Length);\r
+ LowLevelWrite (value);
+ \r
if (iflush)\r
Flush ();\r
}\r