I have been playing around with Hadoop and right now I am trying to figure out a way to read multiple files from a directory. The code below works fine when I read a file. What would be the best way to read multiple files from hdfs and read each line form every file.
try {
Path pt = new Path("hdfs://profile/generate/work/output/errors.txt");
FileSystem fs = FileSystem.get(job.getConfiguration());
BufferedReader br=new BufferedReader(new InputStreamReader(fs.open(pt)));
String line;
line=br.readLine();
while (line !=null){
//sendemail
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}