Richard Liang wrote:
Paulex Yang wrote:
I see, the OutputStreamWriterTest does fail, seems there's some
problem for CharsetDecoder to handling UTF-8 byte stream, but the
InputStreamReader itself should work because it pass all tests for
other decoding. I'll go on to study it.
And I also realized there is a bug in my former proposal - it cannot
support the non-blocking InputStream, so the revisited version is as
below:
private void fillBuf() throws IOException {
chars.clear();
int read = 0;
do{
try {
read = in.read(bytes.array());
} catch (IOException e) {
chars.limit(0);
throw e;
}
boolean endOfInput = false;
if(read == -1){
bytes.limit(0);
endOfInput = true;
}else{
bytes.limit(read);
}
decoder.decode(bytes, chars, endOfInput);
bytes.clear();
}while(read > 0 && chars.position() == 0);
//the main difference with prior version is to check read>0 instead
of read != -1, so that the InputStreamReader based on non-blocking
InputStream can return immediatelly
chars.flip();
}
Yes. It IS a bug of ICU4JNI. I have submitted a bug [1] for ICU and
have proposed a fix for it.
[1] http://bugs.icu-project.org/cgi-bin/icu-bugs/incoming?findid=5180
Great! Thank you, Richard. Vladimir, how about I attach patch for
InputStreamReader to Harmony-166 at first? At least, it can make
InputStreamReaderTest pass.
Richard, have you tried the OutputStreamWriterTest with your patch for
ICU and my modification to InputStreamReader?
--
Paulex Yang
China Software Development Lab
IBM
---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]