當前位置: 首頁>>代碼示例>>Java>>正文


Java FileUtil.copyMerge方法代碼示例

本文整理匯總了Java中org.apache.hadoop.fs.FileUtil.copyMerge方法的典型用法代碼示例。如果您正苦於以下問題:Java FileUtil.copyMerge方法的具體用法?Java FileUtil.copyMerge怎麽用?Java FileUtil.copyMerge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.hadoop.fs.FileUtil的用法示例。


在下文中一共展示了FileUtil.copyMerge方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: run

import org.apache.hadoop.fs.FileUtil; //導入方法依賴的package包/類
/**
 *
 * @return result - Frobenius Norm
 * @throws IOException
 * @throws ClassNotFoundException
 * @throws InterruptedException
 */
public Double run() throws IOException, ClassNotFoundException, InterruptedException {

    String wd = configuration.get("wd");
    Path wdPath = new Path(wd);

    Job job = Job.getInstance(configuration, "DF1");

    Path tmpPath = new Path(configuration.get("wd"), "dftmp");

    job.setJarByClass(MRNMF.class);

    FileInputFormat.addInputPath(job, new Path(Xpath));
    MatrixUpdater.addInpuPath(job, new Path(FGPath));
    FileOutputFormat.setOutputPath(job, tmpPath);

    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(TextOutputFormat.class);

    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(Text.class);

    job.setMapperClass(DFMapper1.class);
    job.setReducerClass(DFReducer1.class);

    job.waitForCompletion(true);

    job = Job.getInstance(configuration, "DF2");

    job.setJarByClass(MRNMF.class);

    MatrixUpdater.addInpuPath(job, tmpPath);
    FileOutputFormat.setOutputPath(job, new Path(wdPath, outputDir));

    job.setInputFormatClass(TextInputFormat.class);
    job.setOutputFormatClass(TextOutputFormat.class);

    job.setMapOutputKeyClass(LongWritable.class);
    job.setMapOutputValueClass(Text.class);

    job.setMapperClass(DFMapper2.class);
    job.setReducerClass(DFReducer2.class);

    job.waitForCompletion(true);

    FileSystem wdfs = wdPath.getFileSystem(new Configuration());
    FileUtil.copyMerge(wdfs, new Path(wd, outputDir), wdfs, new Path(wd, resultFileName), false, new Configuration(), "");

    return getResult(wdfs, new Path(wd, resultFileName));
}
 
開發者ID:Romm17,項目名稱:MRNMF,代碼行數:57,代碼來源:DistanceFinder.java


注:本文中的org.apache.hadoop.fs.FileUtil.copyMerge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。