I replaced sun.io converters by an adaptor to sun.nio.cs coders

Xueming Shen Xueming.Shen at Sun.COM
Thu Sep 4 22:59:22 UTC 2008


Ulf, you are really productive:-) thanks for working so hard on the 
"adapter" idea!

Took a very quick scan on the ByteToChar adapter, here are some comments 
for your considering

(1)in convert(), the decoder.decode(src, dst, true) is used instead of 
the decode(src, dst, false), which probably
is against the specified "a buffer by buffer conversion" use scenario, 
consider the possibility that we have some
"incomplete" bytes in the "input" stream, which might be "completed" by 
sequential "input" in a second invoking
of convert().

(2)flush(),  the spec says you need to "reset() before throw the 
MalformedInputException,so the charOff need
to be zero.

(3)reset() does not set the badInputlength to 0.


sherman



Ulf Zibis wrote:
> Hi Sherman and all other readers on this list,
>
> I've finished my work for an adapter, so all 
> sun.io.CharToByte/ByteToChar implementations can be thrown out.
>
> Result: only 13 classes (including inner classes) instead of 332 
> classes in sun.io package are needed.
>
> See my sources:
> https://java-nio-charset-enhanced.dev.java.net/source/browse/java-nio-charset-enhanced/tags/milestone2/src/sun/io/ 
>
>
> Separate JAR to pre-load by -Xbootclasspath/p:sun_io.jar
> https://java-nio-charset-enhanced.dev.java.net/servlets/ProjectDocumentList?folderID=9164&expandFolder=9164 
>
>
> Homepage:
> https://java-nio-charset-enhanced.dev.java.net
>
> -Ulf
>
>
>
> Am 24.06.2008 17:58, Xueming Shen schrieb:
>> ... one of the ideas is to write a adaptor class to bridge the 
>> sun.io.Converter to sun.nio.cs
>> implementation, so we can eliminate all those CharToByte/ByteToChar 
>> implementation, I have a
>> draft implementation in one of my ws, but have not fully tested, will 
>> dig it out later.
>>
>>
>




More information about the core-libs-dev mailing list