public static int readFile(Boolean printValues, FileSystem fs, Path inputPath,
Configuration conf) throws IOException, InstantiationException, IllegalAccessException {
int count = 0;
Reader reader = new SequenceFile.Reader(fs, inputPath, conf);
Writable key = (Writable) reader.getKeyClass().newInstance();
Writable value = (Writable) reader.getValueClass().newInstance();
System.out.println("key class:" + key.getClass().getName());
System.out.println("value class:" + value.getClass().getName());
while (reader.next(key, value)) {
if (printValues)
System.out.print("\nkey:" + key.toString() + ", value:" + value.toString());
count++;
}
reader.close();
System.out.println("\n" + inputPath.getName() + " has " + count + " records");
return count;
}
SeqReader.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:pss
作者:
评论列表
文章目录