Adding a fixate method to StringBuilder and StringBuffer.

Paulo Levi i30817 at
Wed Apr 15 16:54:44 UTC 2009

Since CharSequence is obviously flawed in that it doesn't allow efficient
read-only views because of a missing method, there are various methods in
the jdk where a stringbuilder/buffer is built, populated and then
toString()-ed and left to be garbage collected. I'm seeing places,
especially in the Document classes, where this originates a OutOfMemory
exception, because the second buffers can't be created concurrently.
I'm asking for a
public final String fixate()
method for both stringbuffer and builder that reuses the internal char array
on a private String constructor (that takes the array), and sets a flag to
never allow the buffer to be modified again.

But what i would really like is that the CharSequence interface would
altered. CharSequence2.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the core-libs-dev mailing list