第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Java 文件復制 - 如何備份/復制輸入文件到其他目標位置?

Java 文件復制 - 如何備份/復制輸入文件到其他目標位置?

皈依舞 2023-07-13 17:50:02
在執(zhí)行任何任務(wù)之前想要將文件復制/備份到目標文件夾。(jdk-1.7) /*Input file path taken from properties file as string is :inputFilewhere-in inputFile is :C:\\Project\\input\\filename.txtDestination file path taken from properties file as string is : archiveFolderPath */  //Existing code : in mainif (inputFile != null) {readTextFile(new File(inputFile)); }// in readTextFile methodBufferedReader br = new BufferedReader(new FileReader(filename));我嘗試使用以下過程::但出現(xiàn)錯誤:錯誤::文件類型中的方法復制(InputStream,OutputStream)不適用于參數(shù)(字符串,字符串)//Calling method in main::copyFiles(inputFile, archiveFolderPath);//Copy method :private static void copyFiles (String inputFile, String   archiveFolderPath) throws IOException {    Files.copy(inputFile, archiveFolderPath); }請建議替代解決方案,如“文件不適用于參數(shù)(字符串,字符串)”。
查看完整描述

1 回答

?
蝴蝶不菲

TA貢獻1810條經(jīng)驗 獲得超4個贊

您可以在對文件執(zhí)行讀取或?qū)懭氩僮髦皬椭圃撐募?。例子?


Path origin = Paths.get("/home/fm/source.txt");

Path destination = Paths.get("/home/fm/source.bak");


//Copy source.txt to source.bak

Files.copy(origin, destination, StandardCopyOption.COPY_ATTRIBUTES, StandardCopyOption.REPLACE_EXISTING);

Files有關(guān)所有方法的詳細信息,請參閱javadoc copy。他們中的一些人期待CopyOption著爭論。CopyOption根據(jù)節(jié)目要求選擇合適的。


https://docs.oracle.com/javase/7/docs/api/java/nio/file/Files.html https://docs.oracle.com/javase/7/docs/api/java/nio/file/StandardCopyOption.html#COPY_ATTRIBUTES


查看完整回答
反對 回復 2023-07-13
  • 1 回答
  • 0 關(guān)注
  • 133 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號