A PrintStream adds functionality to another output stream, namely the ability to print representations of various data values conveniently. Two other features are provided as well. Unlike other output streams, a PrintStream never throws an IOException; instead, exceptional situations merely set an i
| 31 | * Since: JDK1.0, CLDC 1.0 |
| 32 | */ |
| 33 | public class PrintStream extends FilterOutputStream implements Appendable { |
| 34 | /** |
| 35 | * indicates whether or not this PrintStream has incurred an error. |
| 36 | */ |
| 37 | private boolean ioError; |
| 38 | |
| 39 | /** |
| 40 | * indicates whether or not this PrintStream should flush its contents after |
| 41 | * printing a new line. |
| 42 | */ |
| 43 | private boolean autoFlush; |
| 44 | |
| 45 | private String encoding; |
| 46 | |
| 47 | /** |
| 48 | * Constructs a new {@code PrintStream} with {@code out} as its target |
| 49 | * stream. By default, the new print stream does not automatically flush its |
| 50 | * contents to the target stream when a newline is encountered. |
| 51 | * |
| 52 | * @param out |
| 53 | * the target output stream. |
| 54 | * @throws NullPointerException |
| 55 | * if {@code out} is {@code null}. |
| 56 | */ |
| 57 | public PrintStream(OutputStream out) { |
| 58 | super(out); |
| 59 | if (out == null) { |
| 60 | throw new NullPointerException("out == null"); |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * Constructs a new {@code PrintStream} with {@code out} as its target |
| 66 | * stream. The parameter {@code autoFlush} determines if the print stream |
| 67 | * automatically flushes its contents to the target stream when a newline is |
| 68 | * encountered. |
| 69 | * |
| 70 | * @param out |
| 71 | * the target output stream. |
| 72 | * @param autoFlush |
| 73 | * indicates whether to flush contents upon encountering a |
| 74 | * newline sequence. |
| 75 | * @throws NullPointerException |
| 76 | * if {@code out} is {@code null}. |
| 77 | */ |
| 78 | public PrintStream(OutputStream out, boolean autoFlush) { |
| 79 | super(out); |
| 80 | if (out == null) { |
| 81 | throw new NullPointerException("out == null"); |
| 82 | } |
| 83 | this.autoFlush = autoFlush; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Constructs a new {@code PrintStream} with {@code out} as its target |
| 88 | * stream and using the character encoding {@code charsetName} while writing. The |
| 89 | * parameter {@code autoFlush} determines if the print stream automatically |
| 90 | * flushes its contents to the target stream when a newline is encountered. |
nothing calls this directly
no outgoing calls
no test coverage detected