< prev index next >
src/java.base/share/classes/java/io/CharArrayWriter.java
Print this page
rev 15365 : imported patch 8163517-Various-cleanup-in-java-io-code
*** 163,181 ****
* 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 CharArrayWriter append(CharSequence csq) {
! String s = (csq == null ? "null" : csq.toString());
write(s, 0, s.length());
return this;
}
/**
--- 163,181 ----
* 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 CharArrayWriter append(CharSequence csq) {
! String s = String.valueOf(csq);
write(s, 0, s.length());
return this;
}
/**
*** 191,201 ****
*
* @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
--- 191,201 ----
*
* @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
*** 210,222 ****
* {@code csq.length()}
*
* @since 1.5
*/
public CharArrayWriter append(CharSequence csq, int start, int end) {
! String s = (csq == null ? "null" : csq).subSequence(start, end).toString();
! write(s, 0, s.length());
! return this;
}
/**
* Appends the specified character to this writer.
*
--- 210,221 ----
* {@code csq.length()}
*
* @since 1.5
*/
public CharArrayWriter 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.
*
*** 249,259 ****
/**
* Returns a copy of the input data.
*
* @return an array of chars copied from the input data.
*/
! public char toCharArray()[] {
synchronized (lock) {
return Arrays.copyOf(buf, count);
}
}
--- 248,258 ----
/**
* Returns a copy of the input data.
*
* @return an array of chars copied from the input data.
*/
! public char[] toCharArray() {
synchronized (lock) {
return Arrays.copyOf(buf, count);
}
}
< prev index next >