close

readUTF() 是專門用來讀取用 writeUTF() 寫出的字串, 不能用來讀取一般的文字資料..
你可以考慮這麼做:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
            final InputStreamReader reader = new InputStreamReader(
                connection.openInputStream(),
                "Big5");
            try {
                int i;
                while ((i = reader.read()) != -1) {
                    char c = (char)i;
 
                    // Do whatever you want.
                }
            }
            finally {
                reader.close();
            }
arrow
arrow
    全站熱搜

    pcwiki 發表在 痞客邦 留言(0) 人氣()