- Path hdfsPath = new Path(args[0]);
- Configuration conf = new Configuration();
- FileSystem fs = FileSystem.get(hdfsPath.toUri(),conf);
- CompressionCodecFactory factory = new CompressionCodecFactory(conf);
- CompressionCodec codec = factory.getCodec(hdfsPath);
-
- FSDataInputStream inputStream = fs.open(hdfsPath);
- BufferedReader reader = null;
-
- try {
- if (codec == null) {
- reader = new BufferedReader(new InputStreamReader(inputStream));
- } else {
- CompressionInputStream comInputStream = codec.createInputStream(inputStream);
- reader = new BufferedReader(new InputStreamReader(comInputStream));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
posted @
2014-07-22 11:04
曹守鑫
阅读(
400)
评论()
编辑
收藏
举报