<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)

    我參與的團隊

    隨筆檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 222www在线观看免费| 免费中文字幕视频| 亚洲日本在线看片| 亚洲av永久无码精品网站| 亚洲午夜在线电影| 91精品国产免费入口| 国产片免费福利片永久| 国产精品亚洲mnbav网站| 亚洲久本草在线中文字幕| 99久久国产精品免费一区二区| 88av免费观看入口在线| 老司机亚洲精品影院| 国产亚洲精品美女久久久久| 永久免费av无码网站yy| 亚洲精品无码久久久久| 亚洲女女女同性video| 国产区在线免费观看| 成年女人免费视频播放77777| 中文字幕亚洲第一| 亚洲人成人无码.www石榴| 国产精品久久免费视频| 国产区在线免费观看| 亚洲香蕉免费有线视频| 皇色在线免费视频| 久久青青成人亚洲精品| 中国在线观看免费国语版| 亚洲精品蜜桃久久久久久| 亚欧免费一级毛片| 亚洲高清无码在线观看| 亚洲熟女精品中文字幕| 69视频免费观看l| 亚洲精品精华液一区二区| **真实毛片免费观看| 亚洲爆乳成av人在线视菜奈实| 亚洲一区二区精品视频| 95老司机免费福利| 国产亚洲综合一区二区三区| 亚洲视频在线观看免费| 哒哒哒免费视频观看在线www | 亚洲精彩视频在线观看| 中国精品一级毛片免费播放|