@Override
public int count(String path) throws FileNotFoundException {
Path file = new Path(path);
SequenceFile.Reader reader;
int i = 0;
try {
reader = new SequenceFile.Reader(conf, Reader.file(file));
Writable key = (Writable)ReflectionUtils.newInstance(reader.getKeyClass(), conf);
Writable value = (Writable)ReflectionUtils.newInstance(reader.getValueClass(), conf);
while(reader.next(key, value)) {
i++;
}
reader.close();
} catch(FileNotFoundException fne){
throw new FileNotFoundException();
}catch (IOException e) {
// TODO Auto-generated catch block
LOG.error("Error occurred while reading file {} : ", file, StringUtils.stringifyException(e));
throw new WebApplicationException();
}
return i;
}
LinkReader.java 文件源码
java
阅读 19
收藏 0
点赞 0
评论 0
项目:GeoCrawler
作者:
评论列表
文章目录