创建项目 引入依赖包
编写代码 运行
@Test
public void append(){
Configuration conf=new Configuration();
Path path=new Path("hdfs://server1:8020/file/wy/abcde");
FileSystem fileSystem;
try {
fileSystem = path.getFileSystem(conf);
SequenceFile.Reader reader = new SequenceFile.Reader(fileSystem, path, conf);
IntWritable key=new IntWritable();
Text value=new Text();
while(reader.next(key, value)){
System.out.println(key+"======"+value);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}