Fix null sessions in HttpContextWrapper.Session
[mono.git] / mcs / class / corlib / System.IO / UnexceptionalStreamWriter.cs
1 //
2 // System.IO.StreamWriter.cs
3 //
4 // Authors:
5 //   Dietmar Maurer (dietmar@ximian.com)
6 //   Paolo Molaro (lupus@ximian.com)
7 //   Dick Porter (dick@ximian.com)
8 //
9 // (C) Ximian, Inc.  http://www.ximian.com
10 //
11
12 //
13 // Copyright (C) 2004 Novell, Inc (http://www.novell.com)
14 //
15 // Permission is hereby granted, free of charge, to any person obtaining
16 // a copy of this software and associated documentation files (the
17 // "Software"), to deal in the Software without restriction, including
18 // without limitation the rights to use, copy, modify, merge, publish,
19 // distribute, sublicense, and/or sell copies of the Software, and to
20 // permit persons to whom the Software is furnished to do so, subject to
21 // the following conditions:
22 // 
23 // The above copyright notice and this permission notice shall be
24 // included in all copies or substantial portions of the Software.
25 // 
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
27 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
28 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
29 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
30 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
31 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
32 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
33 //
34
35
36 // This is a wrapper around StreamWriter used by System.Console that
37 // catches IOException so that graphical applications don't suddenly
38 // get IO errors when their terminal vanishes (ie when they spew debug
39 // output.)  See UnexceptionalStreamReader too.
40
41 using System.Text;
42 using System;
43
44 namespace System.IO {
45         internal class UnexceptionalStreamWriter: StreamWriter
46         {
47 /*
48                 public UnexceptionalStreamWriter (Stream stream)
49                         : base (stream)
50                 {
51                 }
52 */
53                 public UnexceptionalStreamWriter (Stream stream,
54                                                   Encoding encoding)
55                         : base (stream, encoding)
56                 {
57                 }
58 /*
59                 public UnexceptionalStreamWriter (Stream stream,
60                                                   Encoding encoding,
61                                                   int bufferSize)
62                         : base (stream, encoding, bufferSize)
63                 {
64                 }
65
66                 public UnexceptionalStreamWriter (string path)
67                         : base (path)
68                 {
69                 }
70
71                 public UnexceptionalStreamWriter (string path, bool append)
72                         : base (path, append)
73                 {
74                 }
75
76                 public UnexceptionalStreamWriter (string path, bool append,
77                                                   Encoding encoding)
78                         : base (path, append, encoding)
79                 {
80                 }
81
82                 public UnexceptionalStreamWriter (string path, bool append,
83                                                   Encoding encoding,
84                                                   int bufferSize)
85                         : base (path, append, encoding, bufferSize)
86                 {
87                 }
88 */
89                 public override void Flush ()
90                 {
91                         try {
92                                 base.Flush ();
93                         } catch (Exception) {
94                         }
95                 }
96
97                 public override void Write (char[] buffer, int index,
98                                             int count)
99                 {
100                         try {
101                                 base.Write (buffer, index, count);
102                         } catch (Exception) {
103                         }
104                 }
105
106                 public override void Write (char value)
107                 {
108                         try {
109                                 base.Write (value);
110                         } catch (Exception) {
111                         }
112                 }
113
114                 public override void Write (char[] value)
115                 {
116                         try {
117                                 base.Write (value);
118                         } catch (Exception) {
119                         }
120                 }
121
122                 public override void Write (string value)
123                 {
124                         try {
125                                 base.Write (value);
126                         } catch (Exception) {
127                         }
128                 }
129         }
130 }