144 |
} |
} |
145 |
|
|
146 |
/** |
/** |
147 |
|
* This initializes a new PrintWriter object to write to the specified |
148 |
|
* file. It creates a FileOutputStream object and wraps it in an |
149 |
|
* OutputStreamWriter using the default encoding. |
150 |
|
* @param file name of the file to write to |
151 |
|
* @throws FileNotFoundException if the file cannot be written or created |
152 |
|
* |
153 |
|
* @since 1.5 |
154 |
|
*/ |
155 |
|
public PrintWriter(String file) throws FileNotFoundException |
156 |
|
{ |
157 |
|
this(new FileOutputStream(file)); |
158 |
|
} |
159 |
|
|
160 |
|
/** |
161 |
|
* This initializes a new PrintWriter object to write to the specified |
162 |
|
* file. It creates a FileOutputStream object and wraps it in an |
163 |
|
* OutputStreamWriter using the specified encoding. |
164 |
|
* @param file name of the file to write to |
165 |
|
* @param enc the encoding to use |
166 |
|
* @throws FileNotFoundException if the file cannot be written or created |
167 |
|
* @throws UnsupportedEncodingException if the encoding is not supported |
168 |
|
* |
169 |
|
* @since 1.5 |
170 |
|
*/ |
171 |
|
public PrintWriter(String file, String enc) |
172 |
|
throws FileNotFoundException, UnsupportedEncodingException |
173 |
|
{ |
174 |
|
this(new OutputStreamWriter(new FileOutputStream(file), enc)); |
175 |
|
} |
176 |
|
|
177 |
|
/** |
178 |
|
* This initializes a new PrintWriter object to write to the specified |
179 |
|
* file. It creates a FileOutputStream object and wraps it in an |
180 |
|
* OutputStreamWriter using the default encoding. |
181 |
|
* @param file the file to write to |
182 |
|
* @throws FileNotFoundException if the file cannot be written or created |
183 |
|
* |
184 |
|
* @since 1.5 |
185 |
|
*/ |
186 |
|
public PrintWriter(File file) throws FileNotFoundException |
187 |
|
{ |
188 |
|
this(new FileOutputStream(file)); |
189 |
|
} |
190 |
|
|
191 |
|
/** |
192 |
|
* This initializes a new PrintWriter object to write to the specified |
193 |
|
* file. It creates a FileOutputStream object and wraps it in an |
194 |
|
* OutputStreamWriter using the specified encoding. |
195 |
|
* @param file the file to write to |
196 |
|
* @param enc the encoding to use |
197 |
|
* @throws FileNotFoundException if the file cannot be written or created |
198 |
|
* @throws UnsupportedEncodingException if the encoding is not supported |
199 |
|
* |
200 |
|
* @since 1.5 |
201 |
|
*/ |
202 |
|
public PrintWriter(File file, String enc) |
203 |
|
throws FileNotFoundException, UnsupportedEncodingException |
204 |
|
{ |
205 |
|
this(new OutputStreamWriter(new FileOutputStream(file), enc)); |
206 |
|
} |
207 |
|
|
208 |
|
/** |
209 |
* This method can be called by subclasses to indicate that an error |
* This method can be called by subclasses to indicate that an error |
210 |
* has occurred and should be reported by <code>checkError</code>. |
* has occurred and should be reported by <code>checkError</code>. |
211 |
*/ |
*/ |