< prev index next >

src/java.base/share/classes/java/io/BufferedWriter.java

Print this page
rev 11212 : 8068498: Remove constructor dependency on line.separator from PrintWriter and BufferedWriter

*** 71,86 **** private int nChars, nextChar; private static int defaultCharBufferSize = 8192; /** - * Line separator string. This is the value of the line.separator - * property at the moment that the stream was created. - */ - private String lineSeparator; - - /** * Creates a buffered character-output stream that uses a default-sized * output buffer. * * @param out A Writer */ --- 71,80 ----
*** 103,115 **** throw new IllegalArgumentException("Buffer size <= 0"); this.out = out; cb = new char[sz]; nChars = sz; nextChar = 0; - - lineSeparator = java.security.AccessController.doPrivileged( - new sun.security.action.GetPropertyAction("line.separator")); } /** Checks to make sure that the stream has not been closed */ private void ensureOpen() throws IOException { if (out == null) --- 97,106 ----
*** 238,248 **** * newline ('\n') character. * * @exception IOException If an I/O error occurs */ public void newLine() throws IOException { ! write(lineSeparator); } /** * Flushes the stream. * --- 229,239 ---- * newline ('\n') character. * * @exception IOException If an I/O error occurs */ public void newLine() throws IOException { ! write(System.lineSeparator()); } /** * Flushes the stream. *
< prev index next >