Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGert Driesen <drieseng@users.sourceforge.net>2008-08-16 02:00:24 +0400
committerGert Driesen <drieseng@users.sourceforge.net>2008-08-16 02:00:24 +0400
commit8d3024b0868958cfca3b796ef58ab5f285145cba (patch)
tree96854dd7d749603fd667ff81336a838314a4f9bf /mcs/class/corlib/System.IO/StreamWriter.cs
parent5daa245e52a4e89a0aa7845b1ce74d5a9407c996 (diff)
* StreamWriter.cs: Change argument check for buffersize to require
positive number. Removed duplicate disposed check for AutoFlush. Removed unnecessary initialization of bools. * StreamWriterTest.cs: Added more .ctor tests. Enabled AutoFlush test. svn path=/trunk/mcs/; revision=110626
Diffstat (limited to 'mcs/class/corlib/System.IO/StreamWriter.cs')
-rw-r--r--mcs/class/corlib/System.IO/StreamWriter.cs18
1 files changed, 7 insertions, 11 deletions
diff --git a/mcs/class/corlib/System.IO/StreamWriter.cs b/mcs/class/corlib/System.IO/StreamWriter.cs
index 9d9a29010be..4a672776ac1 100644
--- a/mcs/class/corlib/System.IO/StreamWriter.cs
+++ b/mcs/class/corlib/System.IO/StreamWriter.cs
@@ -49,7 +49,7 @@ namespace System.IO {
private Encoding internalEncoding;
private Stream internalStream;
- private bool closed = false;
+ private bool closed;
private bool iflush;
@@ -62,10 +62,10 @@ namespace System.IO {
private char[] decode_buf;
private int decode_pos;
- private bool DisposedAlready = false;
- private bool preamble_done = false;
+ private bool DisposedAlready;
+ private bool preamble_done;
- public new static readonly StreamWriter Null = new StreamWriter (Stream.Null, Encoding.UTF8Unmarked, 0);
+ public new static readonly StreamWriter Null = new StreamWriter (Stream.Null, Encoding.UTF8Unmarked, 1);
public StreamWriter (Stream stream)
: this (stream, Encoding.UTF8Unmarked, DefaultBufferSize) {}
@@ -90,7 +90,7 @@ namespace System.IO {
throw new ArgumentNullException("stream");
if (null == encoding)
throw new ArgumentNullException("encoding");
- if (bufferSize < 0)
+ if (bufferSize <= 0)
throw new ArgumentOutOfRangeException("bufferSize");
if (!stream.CanWrite)
throw new ArgumentException ("Can not write to stream");
@@ -112,7 +112,7 @@ namespace System.IO {
public StreamWriter (string path, bool append, Encoding encoding, int bufferSize) {
if (null == encoding)
throw new ArgumentNullException("encoding");
- if (bufferSize < 0)
+ if (bufferSize <= 0)
throw new ArgumentOutOfRangeException("bufferSize");
FileMode mode;
@@ -137,13 +137,9 @@ namespace System.IO {
return iflush;
}
set {
- if (DisposedAlready)
- throw new ObjectDisposedException("StreamWriter");
iflush = value;
-
- if (iflush) {
+ if (iflush)
Flush ();
- }
}
}