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