< prev index next >

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

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

*** 137,158 **** * 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 * * @since 1.5 */ public StringWriter append(CharSequence csq) { ! if (csq == null) ! write("null"); ! else ! write(csq.toString()); return this; } /** * Appends a subsequence of the specified character sequence to this writer. --- 137,155 ---- * 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 * * @since 1.5 */ public StringWriter append(CharSequence csq) { ! write(String.valueOf(csq)); return this; } /** * Appends a subsequence of the specified character sequence to this writer.
*** 168,178 **** * * @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 --- 165,175 ---- * * @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
*** 187,199 **** * {@code csq.length()} * * @since 1.5 */ public StringWriter append(CharSequence csq, int start, int end) { ! CharSequence cs = (csq == null ? "null" : csq); ! write(cs.subSequence(start, end).toString()); ! return this; } /** * Appends the specified character to this writer. * --- 184,195 ---- * {@code csq.length()} * * @since 1.5 */ public StringWriter append(CharSequence csq, int start, int end) { ! if (csq == null) csq = "null"; ! return append(csq.subSequence(start, end)); } /** * Appends the specified character to this writer. *
< prev index next >