内容摘要:/***导入*@paramurlPath附件相对路径xml存储路径)*@parampath项目绝对路径*@paramkeyID要导出信息的keyID*@paramfilepath导入后路径*/priv

/** * 导入 * @param urlPath 附件相对路径(xml存储路径) * @param path 项目绝对路径 * @param keyID 要导出信息的进件复keyID * @param filepath 导入后路径 */ private static void importCopy(String urlPath, String path, String keyID, String filepath) { // 生成目录 File f = new File(path + filepath); if (!f.exists()) { f.mkdirs(); } String filename = urlPath.substring(urlPath.lastIndexOf("/") + 1); FileInputStream fi = null; FileOutputStream fo = null; FileChannel in = null; FileChannel out = null; try { fi = new FileInputStream(path + "/imp/" + keyID + "/" + filename); //源文件 fo = new FileOutputStream(path + filepath + filename); //导入后文件 in = fi.getChannel();// 得到对应的文件通道 out = fo.getChannel();// 得到对应的文件通道 in.transferTo(0, in.size(), out);// 连接两个通道,
站群服务器并且从in通道读取,行文
然后写入out通道 } catch (IOException e) { e.printStackTrace(); } finally { try { fi.close(); in.close(); fo.close(); out.close(); } catch (IOException e) { e.printStackTrace(); } } }
【本文是进件复专栏作者张勇波的云服务器原创文章,转载请通过获取作者授权】
行文