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 |
|
|
138 |
this.autoflush = autoflush; |
this.autoflush = autoflush; |
139 |
} |
} |
140 |
|
|
141 |
|
/** @since 1.5 */ |
142 |
|
public PrintWriter(String path) |
143 |
|
throws FileNotFoundException |
144 |
|
{ |
145 |
|
this(new OutputStreamWriter(new FileOutputStream(path))); |
146 |
|
} |
147 |
|
|
148 |
|
/** @since 1.5 */ |
149 |
|
public PrintWriter(String path, String encoding) |
150 |
|
throws FileNotFoundException, UnsupportedEncodingException |
151 |
|
{ |
152 |
|
this(new OutputStreamWriter(new FileOutputStream(path), encoding)); |
153 |
|
} |
154 |
|
|
155 |
|
/** @since 1.5 */ |
156 |
|
public PrintWriter(File path) |
157 |
|
throws FileNotFoundException |
158 |
|
{ |
159 |
|
this(new OutputStreamWriter(new FileOutputStream(path))); |
160 |
|
} |
161 |
|
|
162 |
|
/** @since 1.5 */ |
163 |
|
public PrintWriter(File path, String encoding) |
164 |
|
throws FileNotFoundException, UnsupportedEncodingException |
165 |
|
{ |
166 |
|
this(new OutputStreamWriter(new FileOutputStream(path), encoding)); |
167 |
|
} |
168 |
|
|
169 |
/** |
/** |
170 |
* This method can be called by subclasses to indicate that an error |
* This method can be called by subclasses to indicate that an error |
171 |
* has occurred and should be reported by <code>checkError</code>. |
* has occurred and should be reported by <code>checkError</code>. |
595 |
{ |
{ |
596 |
write(str, 0, str.length()); |
write(str, 0, str.length()); |
597 |
} |
} |
598 |
|
|
599 |
|
/** @since 1.5 */ |
600 |
|
public PrintWriter append(char c) |
601 |
|
{ |
602 |
|
write(c); |
603 |
|
return this; |
604 |
|
} |
605 |
|
|
606 |
|
/** @since 1.5 */ |
607 |
|
public PrintWriter append(CharSequence cs) |
608 |
|
{ |
609 |
|
write(cs == null ? "null" : cs.toString()); |
610 |
|
return this; |
611 |
|
} |
612 |
|
|
613 |
|
/** @since 1.5 */ |
614 |
|
public PrintWriter append(CharSequence cs, int start, int end) |
615 |
|
{ |
616 |
|
write(cs == null ? "null" : cs.subSequence(start, end).toString()); |
617 |
|
return this; |
618 |
|
} |
619 |
} |
} |
620 |
|
|