@@ -2037,19 +2037,6 @@ public abstract sealed class $Type$Buffer
2037
2037
* Appends the specified character sequence to this
2038
2038
* buffer <i>(optional operation)</i>.
2039
2039
*
2040
- * <p> An invocation of this method of the form {@code dst.append(csq)}
2041
- * behaves in exactly the same way as the invocation
2042
- *
2043
- * {@snippet lang=java :
2044
- * dst.put(csq.toString())
2045
- * }
2046
- *
2047
- * <p> Depending on the specification of {@code toString} for the
2048
- * character sequence {@code csq}, the entire sequence may not be
2049
- * appended. For instance, invoking the {@link $Type$Buffer#toString()
2050
- * toString} method of a character buffer will return a subsequence whose
2051
- * content depends upon the buffer's position and limit.
2052
- *
2053
2040
* @param csq
2054
2041
* The character sequence to append. If {@code csq} is
2055
2042
* {@code null}, then the four characters {@code "null"} are
@@ -2071,21 +2058,13 @@ public abstract sealed class $Type$Buffer
2071
2058
else if (csq instanceof CharBuffer cb)
2072
2059
return put(cb);
2073
2060
else
2074
- return put (csq.toString ());
2061
+ return append (csq, 0, csq.length ());
2075
2062
}
2076
2063
2077
2064
/**
2078
2065
* Appends a subsequence of the specified character sequence to this
2079
2066
* buffer <i>(optional operation)</i>.
2080
2067
*
2081
- * <p> An invocation of this method of the form {@code dst.append(csq, start,
2082
- * end)} when {@code csq} is not {@code null}, behaves in exactly the
2083
- * same way as the invocation
2084
- *
2085
- * {@snippet lang=java :
2086
- * dst.put(csq.subSequence(start, end).toString())
2087
- * }
2088
- *
2089
2068
* @param csq
2090
2069
* The character sequence from which a subsequence will be
2091
2070
* appended. If {@code csq} is {@code null}, then characters
@@ -2127,7 +2106,9 @@ public abstract sealed class $Type$Buffer
2127
2106
return this;
2128
2107
}
2129
2108
CharSequence cs = (csq == null ? "null" : csq);
2130
- return put(cs.subSequence(start, end).toString());
2109
+ char[] buf = new char[end - start];
2110
+ cs.getChars(start, end, buf, 0);
2111
+ return put(buf);
2131
2112
}
2132
2113
2133
2114
/**
0 commit comments