Changeset 28 for sample/hadoop-0.16/tw/org/nchc/util
- Timestamp:
- Jul 3, 2008, 5:40:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sample/hadoop-0.16/tw/org/nchc/util/SequenceFileProcessor.java
r25 r28 19 19 import java.io.IOException; 20 20 21 import org.apache.hadoop.fs.FileStatus; 21 22 import org.apache.hadoop.fs.FileSystem; 22 23 import org.apache.hadoop.fs.Path; … … 118 119 119 120 private void run() throws IOException { 120 if (!FileSystem.get(conf).isFile(mPath)) { 121 for (Path p : FileSystem.get(conf).listPaths(new Path[] { mPath })) { 121 FileSystem fs = FileSystem.get(conf); 122 if (!fs.isFile(mPath)) { 123 for (Path p : listPaths(fs,mPath)) { 122 124 // System.out.println("Applying to " + p); 123 125 applyToFile(p); … … 128 130 129 131 } 130 132 static public Path[] listPaths(FileSystem fsm,Path path) throws IOException 133 { 134 FileStatus[] fss = fsm.listStatus(path); 135 int length = fss.length; 136 Path[] pi = new Path[length]; 137 for (int i=0 ; i< length; i++) 138 { 139 pi[i] = fss[i].getPath(); 140 } 141 return pi; 142 } 131 143 @SuppressWarnings("unchecked") 132 144 private void applyToFile(Path path) throws IOException {
Note: See TracChangeset
for help on using the changeset viewer.