< prev index next >

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

Print this page
rev 15357 : imported patch 8163517-Various-cleanup-in-java-io-code

*** 219,243 **** * character buffer will return a subsequence whose content depends upon * the buffer's position and limit. * * @param csq * The character sequence to append. If {@code csq} is ! * {@code null}, then the four characters "{@code null}" are * appended to this writer. * * @return This writer * * @throws IOException * If an I/O error occurs * * @since 1.5 */ public Writer append(CharSequence csq) throws IOException { ! if (csq == null) ! write("null"); ! else ! write(csq.toString()); return this; } /** * Appends a subsequence of the specified character sequence to this writer. --- 219,240 ---- * character buffer will return a subsequence whose content depends upon * the buffer's position and limit. * * @param csq * The character sequence to append. If {@code csq} is ! * {@code null}, then the four characters {@code "null"} are * appended to this writer. * * @return This writer * * @throws IOException * If an I/O error occurs * * @since 1.5 */ public Writer append(CharSequence csq) throws IOException { ! write(String.valueOf(csq)); return this; } /** * Appends a subsequence of the specified character sequence to this writer.
*** 254,264 **** * * @param csq * The character sequence from which a subsequence will be * appended. If {@code csq} is {@code null}, then characters * will be appended as if {@code csq} contained the four ! * characters "{@code null}". * * @param start * The index of the first character in the subsequence * * @param end --- 251,261 ---- * * @param csq * The character sequence from which a subsequence will be * appended. If {@code csq} is {@code null}, then characters * will be appended as if {@code csq} contained the four ! * characters {@code "null"}. * * @param start * The index of the first character in the subsequence * * @param end
*** 276,287 **** * If an I/O error occurs * * @since 1.5 */ public Writer append(CharSequence csq, int start, int end) throws IOException { ! CharSequence cs = (csq == null ? "null" : csq); ! write(cs.subSequence(start, end).toString()); return this; } /** * Appends the specified character to this writer. --- 273,284 ---- * If an I/O error occurs * * @since 1.5 */ public Writer append(CharSequence csq, int start, int end) throws IOException { ! if (csq == null) csq = "null"; ! write(csq.subSequence(start, end).toString()); return this; } /** * Appends the specified character to this writer.
< prev index next >