ByteToCharUTF8.java cannot handle long strings

ito at htk.hitachi-cable.co.jp ito at htk.hitachi-cable.co.jp
Fri Mar 3 03:16:19 PST 2000


I am afraid ByteToCharUTF8.java cannot handle long strings.

$ cat Test2.java
import java.io.*;
public class Test2 {
    public static void main(String[] args) {
        try {
            char[] cbuf = new char[16*1024];
            InputStreamReader in
                = new InputStreamReader(new FileInputStream(args[0]),"UTF8");
            int l = in.read(cbuf,0,cbuf.length);
            in.close();
        } catch (Exception e) {
            e.printStackTrace(System.err);
        }
    }
}
$ java Test2 test05in
$ java Test2 test06in
java.lang.Error: assertion failure
        at java.lang.Throwable.<init>(Throwable.java:38)
        at java.lang.Error.<init>(Error.java:21)
        at kaffe.util.Assert.fail(Assert.java:118)
        at kaffe.util.Assert.that(Assert.java:29)
        at kaffe.io.ByteToCharConverter.carry(ByteToCharConverter.java:56)
        at kaffe.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:74)
        at java.io.InputStreamReader.read(InputStreamReader.java:66)
        at Test2.main(Test2.java:8)
$ ls -al test05in test06in
-rw-rw-r--   1 ito      ito            13 Mar  3 19:13 test05in
-rw-rw-r--   1 ito      ito          4092 Mar  3 20:06 test06in
$

Both test05in and test06in are files full of Japanese characters.


More information about the kaffe mailing list