< prev index next >
src/java.base/share/classes/java/io/PrintWriter.java
Print this page
rev 11212 : 8068498: Remove constructor dependency on line.separator from PrintWriter and BufferedWriter
*** 67,82 ****
private boolean trouble = false;
private Formatter formatter;
private PrintStream psOut = null;
/**
- * Line separator string. This is the value of the line.separator
- * property at the moment that the stream was created.
- */
- private final String lineSeparator;
-
- /**
* Returns a charset object for the given charset name.
* @throws NullPointerException is csn is null
* @throws UnsupportedEncodingException if the charset is not supported
*/
private static Charset toCharset(String csn)
--- 67,76 ----
*** 111,122 ****
public PrintWriter(Writer out,
boolean autoFlush) {
super(out);
this.out = out;
this.autoFlush = autoFlush;
- lineSeparator = java.security.AccessController.doPrivileged(
- new sun.security.action.GetPropertyAction("line.separator"));
}
/**
* Creates a new PrintWriter, without automatic line flushing, from an
* existing OutputStream. This convenience constructor creates the
--- 105,114 ----
*** 475,485 ****
private void newLine() {
try {
synchronized (lock) {
ensureOpen();
! out.write(lineSeparator);
if (autoFlush)
out.flush();
}
}
catch (InterruptedIOException x) {
--- 467,477 ----
private void newLine() {
try {
synchronized (lock) {
ensureOpen();
! out.write(System.lineSeparator());
if (autoFlush)
out.flush();
}
}
catch (InterruptedIOException x) {
< prev index next >