<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住
    主站蜘蛛池模板: 免费人成大片在线观看播放电影| 亚洲精品美女在线观看| 含羞草国产亚洲精品岁国产精品| 久久国产精品萌白酱免费| 国产精品亚洲一区二区三区在线| 有码人妻在线免费看片| 亚洲偷自拍拍综合网| GOGOGO免费观看国语| 亚洲av无码成h人动漫无遮挡| 中文字幕在线免费看线人| 久久久久久亚洲精品中文字幕| 九九美女网站免费| 亚洲麻豆精品果冻传媒| 免费人成在线视频| 亚洲私人无码综合久久网| 国产aa免费视频| 国产高潮久久免费观看| 亚洲AV无码一区二区三区DV| 2021在线观看视频精品免费| 亚洲AV综合色区无码二区偷拍 | 亚洲一区二区三区乱码在线欧洲| 99视频在线精品免费观看6| 风间由美在线亚洲一区| 中文字幕亚洲无线码| 99久久精品免费精品国产| 67194在线午夜亚洲| 四虎影视精品永久免费| a级片免费在线播放| 亚洲ts人妖网站| 又爽又黄无遮挡高清免费视频| www成人免费观看网站| 亚洲国产香蕉碰碰人人| 国内自产少妇自拍区免费| 天堂亚洲免费视频| 亚洲高清美女一区二区三区| 国产资源免费观看| 免费人成网站在线观看不卡| 亚洲字幕AV一区二区三区四区| 久久久久亚洲爆乳少妇无| 日本h在线精品免费观看| 免费国产a理论片|