Re: [問題] RandomAccessFile 寫中文的問題
※ 引述《NightPrince (shooting star)》之銘言:
: try
: {
: File file = new File(FILEPATH);
: RandomAccessFile ras = new RandomAccessFile(file , "rw");
: ras.seek(ras.length()); // 這邊是以檔案的最後做範例
: StringBuffer sb = new StringBuffer();
: .
: .
: .
: ras.writeBytes(sb.toString());
改成 ras.write(sb.toString().getBytes());
試試看
: ras.close();
: }
: catch(Exception ex)
: {
: ex.printTraceStack();
: }
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 140.123.219.115
討論串 (同標題文章)
java 近期熱門文章
PTT數位生活區 即時熱門文章