<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住
    主站蜘蛛池模板: 日韩电影免费在线观看中文字幕| 亚洲日韩国产精品乱-久| 偷自拍亚洲视频在线观看| 国产在线观看片a免费观看 | 18禁黄网站禁片免费观看不卡| 国产亚洲色婷婷久久99精品| 黄视频在线观看免费| 亚洲精品无码永久在线观看| 一区二区免费电影| 亚洲人成精品久久久久| 波多野结衣免费一区视频| 亚洲a一级免费视频| 久草视频在线免费| 狠狠色伊人亚洲综合网站色| 免费看美女被靠到爽的视频| 在线91精品亚洲网站精品成人| 亚洲乱码中文字幕手机在线| 中文字幕无线码中文字幕免费| 亚洲av无码成h人动漫无遮挡 | 极品色天使在线婷婷天堂亚洲 | 免费夜色污私人影院网站电影| 亚洲女同成人AⅤ人片在线观看| 精品一区二区三区免费视频| 91亚洲自偷手机在线观看| 最近中文字幕无免费视频| 黄色毛片免费观看| 亚洲av永久无码精品表情包| 中字幕视频在线永久在线观看免费| 亚洲中文字幕无码久久| 国产精品V亚洲精品V日韩精品| 日韩电影免费在线观看| 亚洲精品精华液一区二区| 亚洲性日韩精品一区二区三区| 19禁啪啪无遮挡免费网站| 美女视频黄频a免费大全视频| 久久久久久a亚洲欧洲aⅴ| 99精品全国免费观看视频| 久久www免费人成精品香蕉| 亚洲精品网站在线观看你懂的| 全部免费国产潢色一级| 3344永久在线观看视频免费首页 |