浪跡天涯
          web報表設計器....
          posts - 61,comments - 71,trackbacks - 0
          try ? {???????????????????????RandomAccessFile?out = new ?RandomAccessFile(file, " rw " );?????????????
          out.seek(out.length());
          // 將指針移動到文件末尾
          out.writeBytes( " \r\n " );
          mess?
          = ? " 寫入文件 " ;
          byte ?buffer[]? = ? new ? byte [ 1024 ];
          buffer?
          = ?mess.getBytes();
          out.write(buffer);?
          out.close();
          // 關閉文件流?
          }
          ? catch ?(IOException?e)? {
          ??e.printStackTrace();
          }
          posted on 2008-03-26 14:19 JJCEA 閱讀(5216) 評論(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.  回復  更多評論
            
          # re: 解決RandomAccessFile寫入文件亂碼的辦法[未登錄]
          2008-03-26 15:07 | AA
          明明就是追加,誰都會的  回復  更多評論
            
          # re: 解決RandomAccessFile寫入文件亂碼的辦法
          2008-03-28 11:07 | senlin-blog
          你會說明你能,但不一定誰都會的,我是說明解決亂碼的問題  回復  更多評論
            
          # 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 "寫入文件".  回復  更多評論
            
          主站蜘蛛池模板: 兴海县| 兴仁县| 洛南县| 依兰县| 呼伦贝尔市| 南江县| 南丰县| 陆川县| 巴彦县| 永安市| 广东省| 民丰县| 万安县| 山丹县| 洛南县| 宜川县| 巫溪县| 偃师市| 莲花县| 衡水市| 鄂托克旗| 兰溪市| 伊宁县| 延川县| 宁远县| 建宁县| 中超| 甘德县| 潜山县| 瓮安县| 大洼县| 六枝特区| 东台市| 普格县| 正蓝旗| 建德市| 五河县| 安远县| 崇仁县| 新乡市| 宜黄县|