Changes between Version 5 and Version 6 of hadoop_tools


Ignore:
Timestamp:
09/24/2012 10:57:50 AM (14 years ago)
Author:
liaojiaohe
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • hadoop_tools

    v5 v6  
    102102}}} 
    103103 
     104 
     105== Head == 
     106 
     107也是要先生成Configuration和处理参数 
     108 
     109{{{ 
     110      FileSystem hdfs = FileSystem.get(conf); //获得HDFS文件系统的对象 
     111 
     112        Path inputDir = new Path(otherArgs[0]); 
     113        if (otherArgs.length > 1) { 
     114            MaxLineNumber = Integer.parseInt(otherArgs[1]) > 0 ? Integer.parseInt(otherArgs[1]) : 10; 
     115        } 
     116 
     117        byte[] buffer = new byte[4096]; 
     118        FSDataInputStream inputStream = hdfs.open(inputDir); 
     119 
     120        GzipCodec codec = new GzipCodec(); 
     121        codec.setConf(conf); 
     122        CompressionInputStream input = codec.createInputStream(inputStream); 
     123}}}