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

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

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


     1 ////////////////////////////////////////////////////////////////
     2 //  
     3 //  程序:ReadWiteFile.java
     4 //
     5 //  描述:對文件讀寫操作
     6 //
     7 //  作者:JAVA-HE
     8 //
     9 //  時間:2006-12-20
    10 //
    11 //////////////////////////////////////////////////////////////
    12 
    13 package com.readwritefile;
    14 
    15 import java.io.*;
    16 public class ReadWiteFile
    17 {
    18     public ReadWiteFile ()
    19     {
    20     }
    21     public static void main(String args [])
    22     {
    23         ReadWiteFile managerFile = new ReadWiteFile();
    24         File readfile = new File("read.txt");
    25         File writefile = new File("write.txt");
    26         String content = "";
    27         try
    28         {
    29             content = managerFile.readFile(readfile);
    30             
    31         }catch(Exception ex)
    32         {
    33             System.out.println ("讀文件發生異常:"+ex.toString ());
    34         }
    35         try
    36         {
    37             managerFile.writeFile(writefile,content);
    38         }catch(Exception e)
    39         {
    40             System.out.println ("寫文件發生異常:"+e.toString ());
    41         }
    42     }
    43     private  String readFile (File readfile) throws Exception 
    44     {
    45         FileReader read = new FileReader(readfile);
    46         BufferedReader in = new BufferedReader(read);
    47         String readResult="";
    48         String str = "";
    49         while((str=in.readLine ())!= null)
    50         {
    51             String tem [] = str.split ("=");
    52             readResult += "m_objCitys.Add \""+tem[1]+"\", \""+tem[0]+"\""+"\n";
    53         }
    54         read.close ();
    55         in.close ();
    56         return readResult;
    57     }
    58 
    59     private void writeFile (File writefile, String content) throws Exception
    60     {
    61         FileWriter write = new FileWriter(writefile);
    62         BufferedWriter wr = new BufferedWriter(write);
    63         wr.write (content);
    64         wr.flush ();
    65         wr.close ();
    66         write.close ();
    67     }
    68     
    69 }
    70 
    71 
    72 
    73 
    74 

    posted on 2007-02-13 14:45 -274°C 閱讀(517) 評論(0)  編輯  收藏 所屬分類: JAVA

    常用鏈接

    留言簿(21)

    隨筆分類(265)

    隨筆檔案(242)

    相冊

    JAVA網站

    關注的Blog

    搜索

    •  

    積分與排名

    • 積分 - 914354
    • 排名 - 40

    最新評論

    主站蜘蛛池模板: 日韩a毛片免费观看| 国产无遮挡又黄又爽免费视频| 美国毛片亚洲社区在线观看| 91亚洲精品视频| 久久久久无码专区亚洲av| 国产成人免费爽爽爽视频| 久久伊人免费视频| 一级毛片免费全部播放| 亚洲精品久久无码av片俺去也| 亚洲网址在线观看你懂的| 国产午夜亚洲精品理论片不卡| 成人免费午夜视频| 97性无码区免费| 免费看男人j放进女人j免费看| 午夜免费国产体验区免费的 | 2022免费国产精品福利在线| 在线a亚洲老鸭窝天堂av高清| 亚洲电影在线播放| 亚洲成人在线网站| 国产成人精品日本亚洲| 国产成人亚洲综合| 亚洲片国产一区一级在线观看 | 亚洲成AV人片在WWW| 亚洲av午夜精品无码专区| 亚洲色大成网站www永久| 久久亚洲一区二区| 亚洲AV综合色区无码一区| 国产精品永久免费视频| 午夜肉伦伦影院久久精品免费看国产一区二区三区 | 丁香花免费完整高清观看| 永久免费在线观看视频| 222www在线观看免费| 毛片无码免费无码播放| 鲁大师在线影院免费观看| 无码日韩精品一区二区免费暖暖| 在线观看黄片免费入口不卡| 国产高清视频免费在线观看| 亚洲精品视频免费观看| 久久久精品视频免费观看| 福利免费在线观看| 久久99免费视频|