浪跡天涯
          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 閱讀(5209) 評論(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 "寫入文件".  回復  更多評論
            
          主站蜘蛛池模板: 十堰市| 阳原县| 阳春市| 资溪县| 惠来县| 裕民县| 高阳县| 闽清县| 西青区| 浦东新区| 理塘县| 正定县| 湖北省| 疏勒县| 普兰店市| 武川县| 玛纳斯县| 项城市| 深水埗区| 绵阳市| 高青县| 墨江| 高陵县| 德化县| 南充市| 工布江达县| 秦安县| 象山县| 商水县| 浠水县| 阜康市| 泾川县| 屏边| 白河县| 三江| 白沙| 唐山市| 新竹市| 淮滨县| 济南市| 琼海市|