1 |
/* PrintWriter.java -- prints primitive values and objects to a stream as text |
/* PrintWriter.java -- prints primitive values and objects to a stream as text |
2 |
Copyright (C) 1998, 1999, 2000, 2001 Free Software Foundation |
Copyright (C) 1998, 1999, 2000, 2001, 2005 Free Software Foundation |
3 |
|
|
4 |
This file is part of GNU Classpath. |
This file is part of GNU Classpath. |
5 |
|
|
72 |
private boolean error; |
private boolean error; |
73 |
|
|
74 |
/** |
/** |
75 |
|
* Set to true if close() has been called on this PrintWriter. |
76 |
|
*/ |
77 |
|
private boolean closed; |
78 |
|
|
79 |
|
/** |
80 |
* This is the underlying <code>Writer</code> we are sending output |
* This is the underlying <code>Writer</code> we are sending output |
81 |
* to |
* to |
82 |
*/ |
*/ |
153 |
} |
} |
154 |
|
|
155 |
/** |
/** |
156 |
* This method checks to see if an error has occurred on this stream. Note |
* This method checks to see if an error has occurred on this |
157 |
* that once an error has occurred, this method will continue to report |
* stream. Note that once an error has occurred, this method will |
158 |
* <code>true</code> forever for this stream. Before checking for an |
* continue to report <code>true</code> forever for this stream. If |
159 |
* error condition, this method flushes the stream. |
* the stream has not been closed, then before checking for an error |
160 |
|
* condition, this method flushes the stream. |
161 |
* |
* |
162 |
* @return <code>true</code> if an error has occurred, |
* @return <code>true</code> if an error has occurred, |
163 |
* <code>false</code> otherwise |
* <code>false</code> otherwise |
164 |
*/ |
*/ |
165 |
public boolean checkError() |
public boolean checkError() |
166 |
{ |
{ |
167 |
flush(); |
if (! closed) |
168 |
|
flush(); |
169 |
return error; |
return error; |
170 |
} |
} |
171 |
|
|
198 |
{ |
{ |
199 |
error = true; |
error = true; |
200 |
} |
} |
201 |
|
closed = true; |
202 |
} |
} |
203 |
|
|
204 |
/** |
/** |