浪跡天涯
          web報(bào)表設(shè)計(jì)器....
          posts - 61,comments - 71,trackbacks - 0
          try ? {???????????????????????RandomAccessFile?out = new ?RandomAccessFile(file, " rw " );?????????????
          out.seek(out.length());
          // 將指針移動(dòng)到文件末尾
          out.writeBytes( " \r\n " );
          mess?
          = ? " 寫入文件 " ;
          byte ?buffer[]? = ? new ? byte [ 1024 ];
          buffer?
          = ?mess.getBytes();
          out.write(buffer);?
          out.close();
          // 關(guān)閉文件流?
          }
          ? catch ?(IOException?e)? {
          ??e.printStackTrace();
          }
          posted on 2008-03-26 14:19 JJCEA 閱讀(5220) 評(píng)論(4)  編輯  收藏 所屬分類: java文件操作

          FeedBack:
          # re: 解決RandomAccessFile寫入文件亂碼的辦法
          2008-03-26 14:54 | Find it, try it, experience it
          I didn't see any thing here can resolve the problem related to encoding.  回復(fù)  更多評(píng)論
            
          # re: 解決RandomAccessFile寫入文件亂碼的辦法[未登錄](méi)
          2008-03-26 15:07 | AA
          明明就是追加,誰(shuí)都會(huì)的  回復(fù)  更多評(píng)論
            
          # re: 解決RandomAccessFile寫入文件亂碼的辦法
          2008-03-28 11:07 | senlin-blog
          你會(huì)說(shuō)明你能,但不一定誰(shuí)都會(huì)的,我是說(shuō)明解決亂碼的問(wèn)題  回復(fù)  更多評(píng)論
            
          # re: 解決RandomAccessFile寫入文件亂碼的辦法
          2008-03-28 13:18 | Find it, try it, experience it
          But...actually there is nothing related to encoding/decoding, you can have a try to set your JVM default encoding to be iso8859-1 or something other than GB2312/GBK/ GB18030, probly you will get something like "XXX" with your code with your input message "寫入文件".  回復(fù)  更多評(píng)論
            
          主站蜘蛛池模板: 潞西市| 汉川市| 博白县| 承德市| 新竹市| 南靖县| 阿拉善左旗| 共和县| 六盘水市| 班戈县| 嘉善县| 洛隆县| 左贡县| 安西县| 客服| 东光县| 宝鸡市| 营口市| 西城区| 千阳县| 宁陵县| 油尖旺区| 读书| 澎湖县| 兴宁市| 双辽市| 乌恰县| 遵义市| 濉溪县| 任丘市| 济南市| 棋牌| 怀远县| 澄江县| 常州市| 渑池县| 昂仁县| 抚远县| 郑州市| 神木县| 鹿泉市|