source: sample/hadoop-0.17/tw/org/nchc/code/Convert.java @ 234

Last change on this file since 234 was 20, checked in by waue, 16 years ago

將改完的 hadoop 0.17版package 放來備份
目前繼續開發 hadoop 0.16 + hbase 1.3

File size: 924 bytes
Line 
1package tw.org.nchc.code;
2import java.io.IOException;
3
4import org.apache.hadoop.fs.FileStatus;
5import org.apache.hadoop.fs.FileSystem;
6import org.apache.hadoop.fs.Path;
7import org.apache.hadoop.mapred.FileInputFormat;
8import org.apache.hadoop.mapred.FileOutputFormat;
9import org.apache.hadoop.mapred.JobConf;
10
11public class Convert
12{ 
13  static public Path[] listPaths(FileSystem fsm,Path path) throws IOException
14  {
15    FileStatus[] fss = fsm.listStatus(path);
16    int length = fss.length;
17    Path[] pi = new Path[length];
18    for (int i=0 ; i< length; i++)
19    {
20      pi[i] = fss[i].getPath();
21    }
22    return pi;
23  }
24  static public void setInputPath(JobConf conf, Path path){
25    FileInputFormat.setInputPaths(conf, path);
26  }
27  static public void addInputPath(JobConf conf, Path path){
28    FileInputFormat.addInputPath(conf, path);
29  }
30  static public void setOutputPath(JobConf conf,Path path){
31    FileOutputFormat.setOutputPath(conf, path);
32  }
33}
Note: See TracBrowser for help on using the repository browser.