harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard Liang (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-410) method decode(ByteBuffer, CharBuffer, boolean) should set correct position in ByteBuffer
Date Wed, 26 Apr 2006 05:14:03 GMT
    [ http://issues.apache.org/jira/browse/HARMONY-410?page=comments#action_12376394 ] 

Richard Liang commented on HARMONY-410:
---------------------------------------

Hi, Vladimir

It's an expected behaviour on Harmony. 

As spec says,

"CoderResult.UNDERFLOW indicates that as much of the input buffer as possible has been decoded.
If there are no bytes remaining and the invoker has no further input then the decoding operation
is complete. Otherwise there is insufficient input for the operation to proceed, so this method
should be invoked again with further input. "

Therefore, Charset.decode saves remaining buffer for next invocation if invoker has further
input. Since the remaining buffer has been stored in Charset.decode, 
the position of "in" ByteBuffer is set to the limit, which means all the byte has been processed
by decode. 

In other words, Charset.decode takes the responsibility  to store remaining bytes. It's streamming
decode.  Unfortunately, some RI doesn't implement as this.

Consider about following scenario: 
decode(in1, out, false) then decode(in2, out, false)

If we depends on the remaining of "in" ByteBuffer, the code will look like:
decode(in1, out, false);
compoundIn2.put(in1);
compoundIn2.put(in2);
decode(compoundIn2);

I think that's not spec expected.

What's your opnion?
Thanks!

> method decode(ByteBuffer, CharBuffer, boolean) should set correct position in ByteBuffer
> ----------------------------------------------------------------------------------------
>
>          Key: HARMONY-410
>          URL: http://issues.apache.org/jira/browse/HARMONY-410
>      Project: Harmony
>         Type: Bug

>   Components: Classlib
>     Reporter: Vladimir Strigun
>     Assignee: Mikhail Loenko
>     Priority: Minor
>  Attachments: Harmony-410_patch.txt, harmony-410_test.txt
>
> When ByteBuffer contain incomplete sequence of bytes for successful decoding, position
in ByteBuffer should be set to latest successful byte. I will attach testcase and patch soon.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


Mime
View raw message