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

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

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

    Java技術專區--Hilly

    http://blog.duyouyou.com
       :: 首頁 :: 新隨筆 :: 聯系 ::  :: 管理

    ?

    // 任務1:
    // 寫一個文件拷貝函數:?fileCopy(String?a?,String?b)???
    // a--表示原文件名???b--表示目標文件名擴展:
    // 如果a是文件,則copy?a到b?文件;
    // 如果a是目錄,則copy?a下的所有文件和文件夾(包括子文件夾)到b目錄下。
    //

    import ?java.io. * ;


    public ? class ?IODemo?{
    ????
    ????
    public ? void ?fileCopy(String?a,?String?b){
    ????????File?file?
    = ? new ?File(a);

    ????????
    if ( ! file.exists()){
    ????????????System.out.println(a?
    + ? " ?Not?Exists. " );
    ????????????
    return ;
    ????????}
    ????????File?fileb?
    = ? new ?File(b);

    ????????
    if (file.isFile()){
    ????????????FileInputStream?fis?
    = ? null ;
    ????????????FileOutputStream?fos?
    = null ;
    ????????????
    try ?{
    ????????????????fis?
    = ? new ?FileInputStream(file);
    ????????????????fos?
    = ?? new ?FileOutputStream(fileb);
    ????????????????
    ????????????????
    byte []?bb? = new ? byte [?( int )file.length()];
    ????????????????fis.read(bb);
    ????????????????fos.write(bb);

    ????????????}
    catch ?(IOException?e){
    ????????????????e.printStackTrace();
    ????????????}
    finally {
    ????????????????
    try ?{
    ????????????????????fis.close();
    ????????????????????fos.close();
    ????????????????}?
    catch ?(IOException?e)?{
    ????????????????????e.printStackTrace();
    ????????????????}
    ????????????}
    ????????}
    else ? if (file.isDirectory()){
    ????????????
    if ( ! fileb.exists()){
    ????????????????fileb.mkdir();
    ????????????}
    ????????????String[]?fileList;
    ????????????fileList?
    = ?file.list();
    ????????????
    for ( int ?i? = ? 0 ;?i? < ?fileList.length;?i ++ ){
    ????????????????fileCopy(a?
    + ? " \\ " ? + ?fileList[i],b? + ? " \\ " ? + ?fileList[i]);
    ????????????}
    ????????}

    ????}
    ????
    }

    評論

    # re: java中IO流拷貝文件或者文件夾(目錄)源代碼  回復  更多評論   

    2006-12-10 22:41 by rew
    謝謝了啊

    # re: java中IO流拷貝文件或者文件夾(目錄)源代碼  回復  更多評論   

    2009-05-08 11:17 by guest
    謝謝樓主 問題已解決

    # Servisy Web 20  回復  更多評論   

    2009-05-18 09:11 by Servisy Web 20
    Good morning. What some people mistake for the high cost of living is really the cost of high living.
    I am from Africa and , too, and now am writing in English, give please true I wrote the following sentence: "Here is why we have developped the now famous phpbb seo url mods currently la premod rencement phpbb seo officielle, qui inclus toutes les.Seo company, seo company india or seo experts are specializing in search engine optimization seo services, website designing services, website design."

    THX :-D, Kincaid.

    # re: java中IO流拷貝文件或者文件夾(目錄)源代碼  回復  更多評論   

    2014-05-02 15:21 by 邱忠林
    求職

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


    網站導航:
     
    Hold住
    主站蜘蛛池模板: 亚洲国产美女视频| 亚洲综合国产一区二区三区| 亚洲一级免费毛片| 蜜桃AV无码免费看永久| 亚洲男人天堂影院| 在线观看免费高清视频| 亚洲色大网站WWW永久网站| 免费鲁丝片一级在线观看| 精品韩国亚洲av无码不卡区| 免费国产综合视频在线看| 日韩免费码中文在线观看| 亚洲成av人片不卡无码久久| eeuss草民免费| 亚洲AV人无码激艳猛片| 在线看片v免费观看视频777| 亚洲啪AV永久无码精品放毛片 | 中文字幕看片在线a免费| 国产成A人亚洲精V品无码性色| 免费A级毛片无码A∨| 中文字幕无码亚洲欧洲日韩| 国产午夜影视大全免费观看| 久久毛片免费看一区二区三区| 久久国产精品亚洲综合| 在线观看av永久免费| 色噜噜噜噜亚洲第一| 国产成人精品日本亚洲| 免费影院未满十八勿进网站| 国产精品亚洲专一区二区三区| 亚洲午夜久久久久久噜噜噜| 国内精自视频品线六区免费| 久久亚洲色WWW成人欧美| 亚洲熟妇无码乱子AV电影| 四虎最新永久免费视频| 免费无码国产在线观国内自拍中文字幕 | 亚洲中文字幕无码久久综合网| 91福利视频免费观看| 久久精品国产亚洲AV未满十八| 亚洲精品午夜无码电影网| 希望影院高清免费观看视频| 成人免费夜片在线观看| 亚洲福利电影在线观看|