review request for 6798511/6860431: Include functionality of Surrogate in Character -> use scenarios

Ulf Zibis Ulf.Zibis at gmx.de
Mon Sep 7 13:01:00 UTC 2009


Am 26.08.2009 20:02, Xueming Shen schrieb:
> Ulf,
>
> "get rid of sun.nio.cs.Surrogate" itself is not a sufficient enough 
> reason to add bunch of new supplementary
> support related APIs into Character and CharBuffer classes.  You 
> probably need to demonstrate more use
> scenarios to show/prove why these new APIs are needed, why they can 
> not be easily achieved by using existing
> APIs and especially you should ask yourself first if these APIs 
> will/should be used/needed by "general public"
> or they are just "specifically" needed by your current 
> application/project.

I have made a search for "surrogate" on sun.font and sun.text.* packages.
I've found > 400 matches.
In search on java.* I found another 291 matches.
Looking deeper in the classes you can find many use scenarios.
E.g. class sun.text.normalizer.UTF16 more ore less is a duplicate of 
sun.nio.cs.Surrogate.

>
> I'm not saying we can NOT add isBMP() (I know icu4j's UCharacter class 
> does have one), just
> believe it's arguably not necessary.
>
> Same as the pair
>
> -- static char highSurrogate(int codePoint);

--> sun.text.normalizer.UTF16.getLeadSurrogate(int char32)

> -- static char lowSurrogate(int codePoint);

--> sun.text.normalizer.UTF16.getTrailSurrogate(int char32)

> -- CharBuffer.putCodePoint(int)

Maybe it would be better to add appendCodePoint(int cp) to Charsequence, 
of something similar.
See: sun.text.normalizer.UTF16.append(StringBuffer target, int char32)
See: java.text.CharacterIterator.CodePointIterator



-Ulf





More information about the core-libs-dev mailing list