[問題] io字元編碼簡轉繁?

看板java作者 (聖子到)時間17年前 (2008/12/29 13:21), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/2 (看更多)
請問一下 如果我有一個文件 我想透過io將他簡轉繁 改怎麼做 我自己寫轉不出來 不知道哪裡寫錯?? import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class NewClass15 { public static void main(String[] args) throws IOException { InputStream fin = new FileInputStream(new File("c:\\a.txt")); // a.txt 裡面是簡體字 FileOutputStream fout = new FileOutputStream(new File("c:\\b.txt")); byte[] c = new byte[512]; while (fin.available() > 0) { fin.read(c); fout.write(new String(c, "BIG5").getBytes("MS950")); } fin.close(); fout.close(); } } -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 210.243.58.130
文章代碼(AID): #19M5v4xc (java)
文章代碼(AID): #19M5v4xc (java)