SequenceFileRead.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:big-data-lite 作者:
public static void main(String[] args) throws IOException {
String uri = args[0];
       String split = args[1];
Configuration conf = new Configuration();
Path path = new Path(uri);
SequenceFile.Reader reader = null;
try {       
reader = new SequenceFile.Reader(conf, Reader.file(path));
       Text key = new Text();
       OrdImageWritable value = new OrdImageWritable();

       int num = 0;

while (reader.next(key, value)) {
           System.out.println(key.toString() + " " + value.getByteLength());
           ImageIO.write(value.getImage(), "jpg", new File("image" +split+"_" + num++ + ".jpg"));
}
} finally {
    IOUtils.closeStream(reader);
    }       
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号