MCPcopy Create free account
hub / github.com/davidgiven/luje / PrintStream

Class PrintStream

lib/java/io/PrintStream.java:32–780  ·  view source on GitHub ↗

Wraps an existing OutputStream and provides convenience methods for writing common data types in a human readable format. This is not to be confused with DataOutputStream which is used for encoding common data types so that they can be read back in. No IOException is thrown by this c

Source from the content-addressed store, hash-verified

30 * has occurred in this stream.
31 */
32public class PrintStream extends FilterOutputStream implements Appendable,
33 Closeable {
34
35 private static final String TOKEN_NULL = "null"; //$NON-NLS-1$
36
37 /**
38 * indicates whether or not this PrintStream has incurred an error.
39 */
40 private boolean ioError;
41
42 /**
43 * indicates whether or not this PrintStream should flush its contents after
44 * printing a new line.
45 */
46 private boolean autoflush;
47
48 private String encoding;
49
50// private final String lineSeparator = AccessController
51// .doPrivileged(new PriviAction<String>("line.separator")); //$NON-NLS-1$
52 private final String lineSeparator = "\n";
53
54 // private Formatter formatter;
55
56 /**
57 * Constructs a new {@code PrintStream} with {@code out} as its target
58 * stream. By default, the new print stream does not automatically flush its
59 * contents to the target stream when a newline is encountered.
60 *
61 * @param out
62 * the target output stream.
63 * @throws NullPointerException
64 * if {@code out} is {@code null}.
65 */
66 public PrintStream(OutputStream out) {
67 super(out);
68 if (out == null) {
69 throw new NullPointerException();
70 }
71 }
72
73 /**
74 * Constructs a new {@code PrintStream} with {@code out} as its target
75 * stream. The parameter {@code autoflush} determines if the print stream
76 * automatically flushes its contents to the target stream when a newline is
77 * encountered.
78 *
79 * @param out
80 * the target output stream.
81 * @param autoflush
82 * indicates whether to flush contents upon encountering a
83 * newline sequence.
84 * @throws NullPointerException
85 * if {@code out} is {@code null}.
86 */
87 public PrintStream(OutputStream out, boolean autoflush) {
88 super(out);
89 if (out == null) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected