<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    甜咖啡

    我的IT空間

    java 讀寫文件

     

            // 寫文件UTF-8格式 寫一行
      public static void writerTxtFile(String filePath, String text) {
      OutputStreamWriter fs;
      try {
      fs = new OutputStreamWriter(new FileOutputStream(filePath, true), "UTF-8");
      fs.write(text + "\n");
      fs.flush();
      fs.close();
      } catch (UnsupportedEncodingException e1) {
      e1.printStackTrace();
      } catch (FileNotFoundException e1) {
      e1.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }
      }
     
      // 寫文件UTF-8格式 寫一行
      public static void writerStringBuffer(String filePath, StringBuffer text) {
      OutputStreamWriter fs;
      try {
      fs = new OutputStreamWriter(new FileOutputStream(filePath, true), "UTF-8");
      fs.write(text + "\n");
      fs.flush();
      fs.close();
      } catch (UnsupportedEncodingException e1) {
      e1.printStackTrace();
      } catch (FileNotFoundException e1) {
      e1.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }
      }
     
      // 寫文件
      public static void writerTxtFile(String filePath, List<String> list) {
      OutputStreamWriter fs;
      try {
      fs = new OutputStreamWriter(new FileOutputStream(filePath, true), "UTF-8");
      for(int i=0; i<list.size(); i++){
      fs.write(list.get(i) + "\n");
      }
      fs.flush();
      fs.close();
      } catch (UnsupportedEncodingException e1) {
      e1.printStackTrace();
      } catch (FileNotFoundException e1) {
      e1.printStackTrace();
      } catch (IOException e) {
      e.printStackTrace();
      }
      }

     

    posted on 2011-11-04 12:33 甜咖啡 閱讀(222) 評論(0)  編輯  收藏


    只有注冊用戶登錄后才能發表評論。


    網站導航:
     

    導航

    <2011年11月>
    303112345
    6789101112
    13141516171819
    20212223242526
    27282930123
    45678910

    統計

    常用鏈接

    留言簿(1)

    我參與的團隊

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 亚洲综合激情另类专区| 免费H网站在线观看的| 国产免费啪嗒啪嗒视频看看| 亚洲午夜久久久久久尤物| 欧亚精品一区三区免费| 亚洲精品电影在线| 99在线观看免费视频| 亚洲第一成年人网站| 91免费播放人人爽人人快乐| 亚洲神级电影国语版| 精品国产无限资源免费观看| 亚洲av午夜精品无码专区| 最近中文字幕无吗高清免费视频| 国产成人精品日本亚洲专区6| 91嫩草国产在线观看免费| 亚洲熟女乱色一区二区三区| 国产区卡一卡二卡三乱码免费| 亚洲人成电影网站色| 国产又黄又爽又猛的免费视频播放| 春暖花开亚洲性无区一区二区 | 波多野结衣一区二区免费视频| 亚洲精品第一国产综合亚AV| 国产乱子影视频上线免费观看| 一级毛片免费观看不收费| 黄页网站免费在线观看| 亚洲日韩久久综合中文字幕| 午夜亚洲国产成人不卡在线| 亚洲a级片在线观看| 国产精品成人四虎免费视频| 4hu四虎免费影院www| 久久精品亚洲中文字幕无码麻豆 | 国产亚洲午夜高清国产拍精品| 国产在线观看免费视频软件| 亚洲国产天堂久久综合| 日本免费久久久久久久网站| 四虎永久精品免费观看| 国产在线观a免费观看| 亚洲国产成人综合| 免费国产精品视频| 免费人成视频在线观看网站| 亚洲经典千人经典日产|