package tw.org.nchc.code; import java.io.IOException; import org.apache.hadoop.fs.FileStatus; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; import org.apache.hadoop.mapred.FileInputFormat; import org.apache.hadoop.mapred.FileOutputFormat; import org.apache.hadoop.mapred.JobConf; public class Convert { static public Path[] listPaths(FileSystem fsm,Path path) throws IOException { FileStatus[] fss = fsm.listStatus(path); int length = fss.length; Path[] pi = new Path[length]; for (int i=0 ; i< length; i++) { pi[i] = fss[i].getPath(); } return pi; } static public void setInputPath(JobConf conf, Path path){ FileInputFormat.setInputPaths(conf, path); } static public void addInputPath(JobConf conf, Path path){ FileInputFormat.addInputPath(conf, path); } static public void setOutputPath(JobConf conf,Path path){ FileOutputFormat.setOutputPath(conf, path); } }