FileSystem fs=FileSystem.get(new URI("hdfs://localhost:9000"),new Configuration());
FileStatus[] flist=fs.listStatus(new Path("input/"));
FSDataInputStream fsdatainput=fs.open(flist[0].getPath());
BufferedReader bfr=new BufferedReader(new InputStreamReader(fsdatainput));
while(bfr.ready())
{
System.out.println(bfr.readLine());
}
直接讀取比較省事!!