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

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

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

    Java技術專區(qū)--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 邱忠林
    求職

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


    網站導航:
    博客園   IT新聞   Chat2DB   C++博客   博問  
     
    Hold住
    主站蜘蛛池模板: 亚洲色自偷自拍另类小说| 嫩草影院免费观看| 久久影视国产亚洲| 污污污视频在线免费观看| 热99re久久免费视精品频软件| 亚洲三级中文字幕| AV无码免费永久在线观看| 亚洲日本在线观看网址| 亚洲w码欧洲s码免费| 亚洲乱码一二三四五六区| 国产一卡2卡3卡4卡2021免费观看 国产一卡2卡3卡4卡无卡免费视频 | 精品女同一区二区三区免费播放 | 黄网站色视频免费看无下截 | 8x8×在线永久免费视频| 亚洲综合色一区二区三区小说| 日本免费人成视频在线观看| 18gay台湾男同亚洲男同| 69天堂人成无码麻豆免费视频| 亚洲乱码在线播放| 午夜成人免费视频| 国产精品亚洲一区二区无码| 亚洲视频人成在线播放| 七色永久性tv网站免费看| 亚洲精品在线网站| 国产视频精品免费| 国产福利在线观看永久免费| 亚洲成人在线网站| 好爽好紧好大的免费视频国产| 国产免费久久久久久无码| 亚洲毛片一级带毛片基地| 国产高清免费的视频| 91免费在线视频| 四虎亚洲精品高清在线观看| 亚洲综合色成在线播放| 99爱在线精品视频免费观看9| 99亚偷拍自图区亚洲| 亚洲综合久久夜AV | 香蕉97超级碰碰碰免费公| 黄页网站在线视频免费| 亚洲三级电影网站| 哒哒哒免费视频观看在线www|