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

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

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

    浪跡天涯
    web報表設計器....
    posts - 61,comments - 71,trackbacks - 0
    ?1 package ?com.paiao.bdpm.flow.base;
    ?2
    ?3 import ?java.io.BufferedReader;
    ?4 import ?java.io.BufferedWriter;
    ?5 import ?java.io.File;
    ?6 import ?java.io.FileReader;
    ?7 import ?java.io.FileWriter;
    ?8
    ?9 public ? class ?ReadTextFile? {
    10 ???? public ?BufferedReader?bufread;
    11 ???? public ?BufferedWriter?bufwriter;
    12 ????File?writefile;
    13 ????String?filepath,?filecontent,?read;
    14 ????String?readStr? = ? "" ;
    15 ???? // 從文本文件中讀取內容
    16 ???? public ?String?readfile(String?path)???
    17 ???? {
    18 ???????? try ? {
    19 ????????????filepath? = ?path;? // 得到文本文件的路徑
    20 ????????????File?file? = ? new ?File(filepath);
    21 ????????????FileReader?fileread? = ? new ?FileReader(file);
    22 ????????????bufread? = ? new ?BufferedReader(fileread);
    23 ???????????? while ?((read? = ?bufread.readLine())? != ? null )? {
    24 ????????????????read? = ?read + " \r\n " ;????????????
    25 ????????????????readStr? = ?readStr? + ?read;
    26 ????????????}

    27 ????????}
    ? catch ?(Exception?d)? {
    28 ????????????System.out.println(d.getMessage());
    29 ????????}

    30 ???????? return ?readStr;? // 返回從文本文件中讀取內容
    31 ????}

    32
    33 ???? // 向文本文件中寫入內容
    34 ???? public ? void ?writefile(String?path,?String?content,? boolean ?append)? {
    35 ???????? try ? {
    36 ???????????? boolean ?addStr? = ?append;? // 通過這個對象來判斷是否向文本文件中追加內容
    37 ????????????filepath? = ?path;? // 得到文本文件的路徑
    38 ????????????filecontent? = ?content;? // 需要寫入的內容
    39 ????????????writefile? = ? new ?File(filepath);
    40 ???????????? if ?(writefile.exists()? == ? false )? // 如果文本文件不存在則創建它?
    41 ???????????? {
    42 ????????????????writefile.createNewFile();
    43 ????????????????writefile? = ? new ?File(filepath);? // 重新實例化
    44 ????????????}

    45 ????????????FileWriter?filewriter? = ? new ?FileWriter(writefile,?addStr);
    46 ???????????? // 刪除原有文件的內容
    47 ????????????java.io.RandomAccessFile?file = ? new ?java.io.RandomAccessFile(path, " rw " );
    48 ????????????file.setLength( 0 );
    49 ???????????? // 寫入新的文件內容
    50 ????????????filewriter.write(filecontent);
    51 ????????????filewriter.close();
    52 ????????????filewriter.flush();
    53 ????????}
    ? catch ?(Exception?d)? {
    54 ????????????System.out.println(d.getMessage());
    55 ????????}

    56 ????}

    57
    58 ???? public ? static ? void ?main(String[]?args)? throws ?Exception? {
    59 ????????ReadTextFile?parse? = ? new ?ReadTextFile();
    60 ????????String?filecontent? = ?parse.readfile( " c:/applicationContext.xml " );????????
    61 ????????parse.writefile( " c:/applicationContext.xml " ,filecontent, true );
    62 ????????
    63 ????}

    64 }
    posted on 2007-08-15 15:10 JJCEA 閱讀(3196) 評論(0)  編輯  收藏 所屬分類: java文件操作
    主站蜘蛛池模板: 久久久久亚洲精品无码网址色欲 | 在线免费视频你懂的| AV免费网址在线观看| 久久99国产亚洲精品观看| 91在线精品亚洲一区二区| 国产精品网站在线观看免费传媒| 亚洲精品视频免费| 色婷婷精品免费视频| 国产国产人免费视频成69大陆| 蜜臀亚洲AV无码精品国产午夜.| 日韩一区二区免费视频| 亚洲第一街区偷拍街拍| 国产精品二区三区免费播放心| 黄色三级三级三级免费看| 亚洲情侣偷拍精品| 精品国产污污免费网站入口| 亚洲日韩精品射精日| 99久久人妻精品免费一区| 亚洲毛片免费观看| 天天看片天天爽_免费播放| 亚洲AV无码AV吞精久久| 久久久久噜噜噜亚洲熟女综合| 你懂的网址免费国产| 亚洲色图校园春色| 毛片免费在线观看网址| 国产av无码专区亚洲av毛片搜| 亚洲精品福利你懂| 性xxxxx大片免费视频| 亚洲视频免费观看| 成人a免费α片在线视频网站| 久久久久久国产精品免费无码| 久久久久亚洲AV无码专区体验| 日本一区二区三区免费高清| 亚洲av最新在线观看网址| 久久久久久亚洲精品不卡| 67pao强力打造高清免费| 亚洲av综合av一区二区三区 | 亚洲AV电影天堂男人的天堂| 国产精品亚洲高清一区二区| 免费国产黄网站在线观看可以下载| 亚洲中文字幕无码爆乳app|