亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

為什么程序總是提醒文件不存在? 文件的確是存在的

public static void copyFileByBuffer(File srcFile,File desFile) throws IOException{

if(!srcFile.exists()){

throw new IllegalArgumentException("The file is not exists.");

}

if(!desFile.isFile()){

throw new IllegalArgumentException("This name not target a file");

}

BufferedInputStream bis = new BufferedInputStream(new FileInputStream(srcFile));

BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(desFile));

int c;

while((c=bis.read())!=-1){

bos.write(c);

bos.flush();

}

bis.close();

bos.close();

}

public static void main(String[] args) throws IOException {

// IOunit.Outputtest();

// IOunit.FileCopy(new File("e:\\word.txt"), new File("e:\\word1.txt"));

IOunit.copyFileByBuffer(new File("E:\\迅雷下載\\weixin6327android880.apk"),

new File("E:\\迅雷下載\\XMPSetupLite-xl81.exe"));

}



錯誤信息:

Exception in thread "main" java.lang.IllegalArgumentException: This name not target a file

at com.wfu.IOunit.copyFileByBuffer(IOunit.java:85)

at com.wfu.IOunit.main(IOunit.java:102)


正在回答

1 回答

apk不是文件,我是這么認為的

0 回復 有任何疑惑可以回復我~
#1

leeu 提問者

換成一個簡單的txt文件也是如此。
2016-10-14 回復 有任何疑惑可以回復我~
#2

leeu 提問者

我懂了。。。。。第二個if應該寫srcFile。。。。
2016-10-14 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消

為什么程序總是提醒文件不存在? 文件的確是存在的

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號