日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
FileChannel進(jìn)行文件復(fù)制
 
 
  1. /**
  2.  * 導(dǎo)入
  3.  * @param urlPath 附件相對(duì)路徑(xml存儲(chǔ)路徑)
  4.  * @param path 項(xiàng)目絕對(duì)路徑
  5.  * @param keyID 要導(dǎo)出信息的keyID
  6.  * @param filepath 導(dǎo)入后路徑
  7.  */
  8. private static void importCopy(String urlPath, String path, String keyID, String filepath) {
  9.  // 生成目錄
  10.  File f = new File(path + filepath);
  11.  if (!f.exists()) {
  12.  f.mkdirs();
  13.  }
  14.  String filename = urlPath.substring(urlPath.lastIndexOf("/") + 1);
  15.  FileInputStream fi = null;
  16.  FileOutputStream fo = null;
  17.  FileChannel in = null;
  18.  FileChannel out = null;
  19.  try {
  20.  fi = new FileInputStream(path + "/imp/" + keyID + "/" + filename); //源文件
  21.  fo = new FileOutputStream(path + filepath + filename); //導(dǎo)入后文件
  22.  in = fi.getChannel();// 得到對(duì)應(yīng)的文件通道
  23.  out = fo.getChannel();// 得到對(duì)應(yīng)的文件通道
  24.  in.transferTo(0, in.size(), out);// 連接兩個(gè)通道,并且從in通道讀取,然后寫入out通道
  25.  } catch (IOException e) {
  26.  e.printStackTrace();
  27.  } finally {
  28.  try {
  29.  fi.close();
  30.  in.close();
  31.  fo.close();
  32.  out.close();
  33.  } catch (IOException e) {
  34.  e.printStackTrace();
  35.  }
  36.  }
  37. }

【本文是專欄作者張勇波的原創(chuàng)文章,轉(zhuǎn)載請(qǐng)通過獲取作者授權(quán)】

創(chuàng)新互聯(lián)專注于高港網(wǎng)站建設(shè)服務(wù)及定制,我們擁有豐富的企業(yè)做網(wǎng)站經(jīng)驗(yàn)。 熱誠為您提供高港營銷型網(wǎng)站建設(shè),高港網(wǎng)站制作、高港網(wǎng)頁設(shè)計(jì)、高港網(wǎng)站官網(wǎng)定制、微信小程序服務(wù),打造高港網(wǎng)絡(luò)公司原創(chuàng)品牌,更為您提供高港網(wǎng)站排名全網(wǎng)營銷落地服務(wù)。


本文題目:FileChannel進(jìn)行文件復(fù)制
網(wǎng)頁URL:http://www.5511xx.com/article/dppsppo.html