A DESCRIPTION OF THE REQUEST :
String and AbstractStringBuilder both have a
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
method. Unfortunately this method is not in CharSequence.
JUSTIFICATION :
java.lang.CharSequence has a method
CharSequence subSequence(int start, int end)
to get parts of the sequence. So there is no reason why there shouldn't be also a
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
to read character data efficiently into an existind buffer. This would allow for efficient generalizations.
Example:
StringReader then could take CharSequence as construction parameter wo wrap arbitrary CharSequences in Readers. It could then copy character data while avoiding unneccessary in-memory copies of these data.
CUSTOMER SUBMITTED WORKAROUND :
Make case differentiations between String, StringBuffer, StringBuilder,...
String and AbstractStringBuilder both have a
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
method. Unfortunately this method is not in CharSequence.
JUSTIFICATION :
java.lang.CharSequence has a method
CharSequence subSequence(int start, int end)
to get parts of the sequence. So there is no reason why there shouldn't be also a
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin)
to read character data efficiently into an existind buffer. This would allow for efficient generalizations.
Example:
StringReader then could take CharSequence as construction parameter wo wrap arbitrary CharSequences in Readers. It could then copy character data while avoiding unneccessary in-memory copies of these data.
CUSTOMER SUBMITTED WORKAROUND :
Make case differentiations between String, StringBuffer, StringBuilder,...
- duplicates
-
JDK-6813523 (str) Add method CharSequence.getChars() as StringBuilder.getChars()
-
- Open
-
-
JDK-8077242 (str) Optimize AbstractStringBuilder.append(CharSequence, int, int) for String argument
-
- Resolved
-