<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 閱讀(526) 評論(0)  編輯  收藏 所屬分類: JAVA

    常用鏈接

    留言簿(21)

    隨筆分類(265)

    隨筆檔案(242)

    相冊

    JAVA網站

    關注的Blog

    搜索

    •  

    積分與排名

    • 積分 - 916903
    • 排名 - 40

    最新評論

    主站蜘蛛池模板: 国产午夜免费福利红片| 国产精品久久免费| 国产成人精品日本亚洲专区| 亚洲av日韩精品久久久久久a| 好男人看视频免费2019中文 | 高清永久免费观看| 国产成人综合亚洲AV第一页| jizz日本免费| 久久久影院亚洲精品| 久久国产乱子伦精品免费不卡| 亚洲国产一区二区三区青草影视| 无码日韩精品一区二区免费暖暖| 亚洲午夜视频在线观看| 最近中文字幕大全免费视频| 亚洲一区二区三区免费视频| 青春禁区视频在线观看直播免费| 亚洲乱亚洲乱妇24p| 亚洲国产午夜福利在线播放| 精品乱子伦一区二区三区高清免费播放| 亚洲日韩乱码中文无码蜜桃臀网站| 中国精品一级毛片免费播放| 久久久久久亚洲Av无码精品专口| 18禁美女裸体免费网站| 亚洲jizzjizz少妇| 伊伊人成亚洲综合人网7777| 精品一区二区三区无码免费视频| 亚洲妓女综合网99| 国产真实伦在线视频免费观看| 一级特黄aaa大片免费看| 亚洲一区二区在线免费观看| 国产美女在线精品免费观看| 国产亚洲精品美女久久久久| 久久久久亚洲AV无码专区网站 | 久久天天躁狠狠躁夜夜免费观看| 亚洲国产AV无码一区二区三区 | 亚洲精品又粗又大又爽A片| 亚洲色偷偷狠狠综合网| 亚洲香蕉免费有线视频| 国产成人亚洲综合无| 亚洲午夜免费视频| 2020久久精品国产免费|