map方法获得文件夹下文件名称

setup方法即为Mapper初始化的方法,可以点击Mapper按F3进行源码查看

    static class MyMapper extends Mapper<Object,Object,Text,Text>{  

         protected void setup(Context context) throws IOException, InterruptedException{
             FileSplit fs = (FileSplit) context.getInputSplit();
             String k = fs.getPath().getName();
             System.out.println(k);
         }

    protected void map(Object key, Object value, Context context) throws IOException, InterruptedException{

    }   
}

猜你喜欢

转载自blog.csdn.net/qq_38262266/article/details/79197351
今日推荐