| 11 | package java.io; |
| 12 | |
| 13 | public class PrintWriter extends Writer { |
| 14 | private static final char[] newline |
| 15 | = System.getProperty("line.separator").toCharArray(); |
| 16 | |
| 17 | private final Writer out; |
| 18 | private final boolean autoFlush; |
| 19 | |
| 20 | public PrintWriter(Writer out, boolean autoFlush) { |
| 21 | this.out = out; |
| 22 | this.autoFlush = autoFlush; |
| 23 | } |
| 24 | |
| 25 | public PrintWriter(Writer out) { |
| 26 | this(out, false); |
| 27 | } |
| 28 | |
| 29 | public PrintWriter(OutputStream out, boolean autoFlush) { |
| 30 | this(new OutputStreamWriter(out), autoFlush); |
| 31 | } |
| 32 | |
| 33 | public PrintWriter(OutputStream out) { |
| 34 | this(out, false); |
| 35 | } |
| 36 | |
| 37 | public synchronized void print(String s) { |
| 38 | try { |
| 39 | out.write(s.toCharArray()); |
| 40 | } catch (IOException e) { } |
| 41 | } |
| 42 | |
| 43 | public void print(Object o) { |
| 44 | print(o.toString()); |
| 45 | } |
| 46 | |
| 47 | public void print(char c) { |
| 48 | print(String.valueOf(c)); |
| 49 | } |
| 50 | |
| 51 | public synchronized void println(String s) { |
| 52 | try { |
| 53 | out.write(s.toCharArray()); |
| 54 | out.write(newline); |
| 55 | if (autoFlush) flush(); |
| 56 | } catch (IOException e) { } |
| 57 | } |
| 58 | |
| 59 | public synchronized void println() { |
| 60 | try { |
| 61 | out.write(newline); |
| 62 | if (autoFlush) flush(); |
| 63 | } catch (IOException e) { } |
| 64 | } |
| 65 | |
| 66 | public void println(Object o) { |
| 67 | println(o.toString()); |
| 68 | } |
| 69 | |
| 70 | public void println(char c) { |
nothing calls this directly
no test coverage detected