java FileSplit类
来源与去向
- 通过inputformat的getsplits方法产生
- 传递给inputformat的createRecordReader方法.
/** A section of an input file. Returned by {@link* InputFormat#getSplits(JobContext)} and passed to* {@link InputFormat#createRecordReader(InputSplit,TaskAttemptContext)}. */*
属性
看看名字就明白了.
private Path file;private long start;private long length;private String[] hosts;private SplitLocationInfo[] hostInfos;
以及getset方法
构造方法
有这四个信息就可以创建Split方法了.
这些信息都可以由inputformat提供
public FileSplit() {}/** Constructs a split with host information** @param file the file name* @param start the position of the first byte in the file to process* @param length the number of bytes in the file to process* @param hosts the list of hosts containing the block, possibly null*/public FileSplit(Path file, long start, long length, String[] hosts) {this.file = file;this.start = start;this.length = length;this.hosts = hosts;}/** Constructs a split with host and cached-blocks information** @param file the file name* @param start the position of the first byte in the file to process* @param length the number of bytes in the file to process* @param hosts the list of hosts containing the block* @param inMemoryHosts the list of hosts containing the block in memory*/public FileSplit(Path file, long start, long length, String[] hosts,String[] inMemoryHosts) {this(file, start, length, hosts);hostInfos = new SplitLocationInfo[hosts.length];for (int i = 0; i < hosts.length; i++) {// because N will be tiny, scanning is probably faster than a HashSetboolean inMemory = false;for (String inMemoryHost : inMemoryHosts) {if (inMemoryHost.equals(hosts[i])) {inMemory = true;break;}}hostInfos[i] = new SplitLocationInfo(hosts[i], inMemory);}}
比较简单的一个类~
java FileSplit类相关推荐
- java字符存储_用java的类集框架做一个字符存储器(15)
11.这是java的关于java的类集框架做一个字符存储器的源代码可以直接进行编译运行,希望大家能够从中获益良多. package niming; //导入ArrayList这个类 import ja ...
- 干货:排名前 16 的 Java 工具类!
2019独角兽企业重金招聘Python工程师标准>>> 干货:排名前 16 的 Java 工具类! 在Java中,工具类定义了一组公共方法,这篇文章将介绍Java中使用最频繁及最 ...
- 排名前 16 的 Java 工具类
转载来自微信公众号:Java 技术栈.如有侵权,请联系作者删除!! 在 Java 中,工具类定义了一组公共方法,这篇文章将介绍 Java 中使用最频繁及最通用的 Java 工具类.以下工具类.方法按使 ...
- Java枚举类使用方式
Java枚举类使用方式 单枚举定义 : /*** * @title: 单枚举定义* @author: wll* @since: 2021-1-27 14:47:54*/ public enum Jud ...
- java流类图结构_java I/O 流总结
一.java 流操作有关的类和接口: 类 说明 Fil ...
- Java Process类的浅学习
Java Process类的浅学习 文章分类:Java编程 今天用了下java.lang.Process类,只是初步的学习,并没有深入实践,因为感觉它的用途并不是很大,偶尔才可能用上,如果要经常使用它 ...
- java File类 常用相关函数
java File类 相关函数 1.构建函数 2.判断相关函数 4.创建相关函数 5.删除相关函数 6.获取相关函数 1.构建函数 /*** File 构造方法* file 常用构造方法* 1: Fi ...
- Java File类总结和FileUtils类
Java File类总结和FileUtils类 文件存在和类型判断 创建出File类的对象并不代表该路径下有此文件或目录. 用public boolean exists()可以判断文件是否存在. Fi ...
- java反射类的字段
java反射类的字段: package com.ma.reflection;import java.lang.reflect.Field;import org.junit.Test;import co ...
最新文章
- hbase put 异步 java_java – HBase BufferedMutator vs PutList性能
- Ruby的.nil? .empty? .blank? .present?区别
- Verilog系统函数(一) $display
- 机器学习 + 深度学习 + 计算机视觉 + 自然语言处理: 原理, 实践以及应用 --- 干货分享(持续更新…)
- maven项目修改java编译版本的方式
- 深度学习之keras (一) 初探
- XP下修改IIS连接数
- 坚持早起21天,每月多赚1000+ (文末有惊喜)
- ctrl c 失效了_[安卓+PC双端]超C女仆无馬中字
- switch语句php,PHPswitch 语句 - PHP教程
- python文字游戏 生成数字菜单_pygame游戏之旅 游戏中添加显示文字
- 《大数据》2015年第3期“网络大数据专题”——基于特征学习的文本大数据内容理解及其发展趋势...
- 比小米12 Pro还好?Redmi K50 Pro+屏幕细节曝光:2K高分直屏
- java代码中发送http请求中使用DnsResolver的问题
- arcgis导出地图分辨率多少合适_地图册制作:ArcGIS分幅制图——以深圳地铁线路图为例...
- linux 提取执行命令后的输出 shell脚本
- kubectl源码分析之config get-contexts
- XSS跨站脚本攻击详解(包括攻击方式和防御方式)
- Scrapy豆瓣电影top250(excel保存和图片下载)
- PMP之项目进度管理
热门文章
- 新冠疫情数据可视化python_【一点资讯】新冠疫情数据分析 | Python可视化工具看全国各地的新增趋势 www.yidianzixun.com...
- vue3.0 抽奖 小功能
- 图像特征计算与表示——基于内容的图像检索
- xml property标签注入一个类变量_Spring-06-依赖注入(DI)
- layer j基本属性
- distinct性能问题_Mysql性能优化:如何给字符串加索引?
- linux系统下idea打包apk教程,intellij idea14打包apk文件和查看sha1值
- c语言实现语音检测vad_AI大语音(二)——语音预处理
- 荒岛余生最后一个包裹_你会为一个排球哭泣吗?电影《荒岛余生》
- 行人属性数据集pa100k_Attribute-Recognition行人属性识别资料