Fastpath for new String(bytes...) and String.getBytes(...)

Ulf Zibis Ulf.Zibis at gmx.de
Fri Mar 20 23:28:33 UTC 2009


Am 21.03.2009 00:02, Xueming Shen schrieb:
>
> to be honest i'm not convinced that a base/abstract-X-coder has any 
> advantage compared to
> current interface approach, at least in this case,  can you explain 
> more? you will have to cast
> anyway in the StringCoding class until the those utility methods get 
> themself into the
> Charset-X-coder class.

1.) You are right, it's not as simple as I thought first, having 
Base/Abstract-X-coder. Maybe there is a Chance by generifying Charset 
and Charset-X-coder.

2.) To implement the 4-way x-codeLoop() methods for general use for all 
sun.nio.cs charsets sun.nio.cs.Base/Abstract-X-coder is the only way, so 
why introduce additional interface. There also constants like MAX_ASCII, 
MALFORMED_EXCEPTION, etc. could be hosted. See:
https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/trunk/src/sun/nio/cs/BaseCharset.java?rev=674&view=markup
https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/trunk/src/sun/nio/cs/SingleByteDecoder_new.java?rev=572&view=markup

-Ulf





More information about the core-libs-dev mailing list