FileSplit 分析
FileSplit类继承于InputSplit
属性和方法:
代码使用详解:
package com.njbdqn.test;
import org.apache.hadoop.mapred.SplitLocationInfo;
import org.apache.hadoop.mapreduce.lib.input.FileSplit;
import java.io.IOException;
/**
* @Author: Stephen
* @Date: 2019/12/10 23:16
* @Content:
*/
public class FileSplitTest {
public static void main(String[] args) throws IOException {
FileSplit fs = new FileSplit();
String pathname=fs.getPath().getName();//获取目录名字
int depth = fs.getPath().depth(); //获取目录深度
fs.getClass();//获取当前类
long length = fs.getLength();//获取文件长度
SplitLocationInfo[] locationInfo =fs.getLocationInfo(); //获取位置信息
String[] locations = fs.getLocations(); //获取位置
}
}