本人理解的就是读取指定目录下文件输出出来
package com.hdfs;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
public class CatTest {
public static void main(String[] args) throws IOException {
Configuration conf=new Configuration();
FileSystem fs=FileSystem.get(conf);
Path f=new Path("/data/example/ydb/22.txt");
FSDataInputStream in=fs.open(f);
BufferedReader br=new BufferedReader(new InputStreamReader(in));
String line="";
while((line=br.readLine())!=null){
line=br.readLine();
System.out.println(line);
}
br.close();
}
}