http://www.zgxue.com/198/1984184.html
--------------------------Demo
protected void setup(Context context) throws IOException, InterruptedException {
Configuration conf = context.getConfiguration();
// 设置配置文件名
System.setProperty("config-file", conf.get("config-file"));
URI[] uris = context.getCacheFiles();
if (uris != null) {
for (URI uri : uris) {
String filename = uri.toString().substring(uri.toString().lastIndexOf("/") + 1);
log.info(BaseConstant.LOG_PREFIX + "cache file is " + filename);
Reader reader = new SequenceFile.Reader(conf, Reader.file(new Path(filename)));
LongWritable key = new LongWritable();
Text value = new Text();
while (reader.next(key, value)) {
String[] datas = value.toString().split("\\|");
}
reader.close();
}
}
}