Last change
on this file since 22 was
19,
checked in by waue, 16 years ago
|
a class with function to transport hadoop api from 0.16 to 0.17
|
File size:
924 bytes
|
Rev | Line | |
---|
[19] | 1 | package tw.org.nchc.code; |
---|
| 2 | import java.io.IOException; |
---|
| 3 | |
---|
| 4 | import org.apache.hadoop.fs.FileStatus; |
---|
| 5 | import org.apache.hadoop.fs.FileSystem; |
---|
| 6 | import org.apache.hadoop.fs.Path; |
---|
| 7 | import org.apache.hadoop.mapred.FileInputFormat; |
---|
| 8 | import org.apache.hadoop.mapred.FileOutputFormat; |
---|
| 9 | import org.apache.hadoop.mapred.JobConf; |
---|
| 10 | |
---|
| 11 | public 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.