当前位置: 首页>>代码示例>>Java>>正文


Java SplitLineReader类代码示例

本文整理汇总了Java中org.apache.hadoop.mapreduce.lib.input.SplitLineReader的典型用法代码示例。如果您正苦于以下问题:Java SplitLineReader类的具体用法?Java SplitLineReader怎么用?Java SplitLineReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SplitLineReader类属于org.apache.hadoop.mapreduce.lib.input包,在下文中一共展示了SplitLineReader类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: LineRecordReader

import org.apache.hadoop.mapreduce.lib.input.SplitLineReader; //导入依赖的package包/类
public LineRecordReader(InputStream in, long offset, long endOffset,
    int maxLineLength, byte[] recordDelimiter) {
  this.maxLineLength = maxLineLength;
  this.in = new SplitLineReader(in, recordDelimiter);
  this.start = offset;
  this.pos = offset;
  this.end = endOffset;    
  filePosition = null;
}
 
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:LineRecordReader.java

示例2: initialize

import org.apache.hadoop.mapreduce.lib.input.SplitLineReader; //导入依赖的package包/类
public void initialize(InputSplit genericSplit, TaskAttemptContext context)  {
    try {
        FileSplit split = (FileSplit)genericSplit;
        Configuration job = context.getConfiguration();
        this.maxLineLength = job.getInt("mapreduce.input.linerecordreader.line.maxlength", 2147483647);
        this.start = split.getStart();
        this.end = this.start + split.getLength();
        Path file = split.getPath();
        FileSystem fs = file.getFileSystem(job);
        this.fileIn = fs.open(file);
        CompressionCodec codec = (new CompressionCodecFactory(job)).getCodec(file);
        if(null != codec) {
            this.isCompressedInput = true;
            this.decompressor = CodecPool.getDecompressor(codec);
            if(codec instanceof SplittableCompressionCodec) {
                SplitCompressionInputStream cIn = ((SplittableCompressionCodec)codec).createInputStream(this.fileIn, this.decompressor, this.start, this.end, SplittableCompressionCodec.READ_MODE.BYBLOCK);
                this.in = new CompressedSplitLineReader(cIn, job, this.recordDelimiterBytes);
                this.start = cIn.getAdjustedStart();
                this.end = cIn.getAdjustedEnd();
                this.filePosition = cIn;
            } else {
                this.in = new SplitLineReader(codec.createInputStream(this.fileIn, this.decompressor), job, this.recordDelimiterBytes);
                this.filePosition = this.fileIn;
            }
        } else {
            this.fileIn.seek(this.start);
            this.in = new SplitLineReader(this.fileIn, job, this.recordDelimiterBytes);
            this.filePosition = this.fileIn;
        }

        if(this.start != 0L) {
            this.start += (long)this.in.readLine(new Text(), 0, this.maxBytesToConsume(this.start));
        }

        this.pos = this.start;
    }catch(Exception ex){
        LOG.warn("Exception occurred during initialization {}", ex, ex);
    }

}
 
开发者ID:Comcast,项目名称:spark-util,代码行数:41,代码来源:ErrorHandlingLineRecordReader.java

示例3: LineRecordReader

import org.apache.hadoop.mapreduce.lib.input.SplitLineReader; //导入依赖的package包/类
public LineRecordReader(InputStream in, long offset, long endOffset,
    int maxLineLength, byte[] recordDelimiter) {
  this.maxLineLength = maxLineLength;
  this.in = new SplitLineReader(in, recordDelimiter);
  this.start = offset;
  this.pos = offset;
  this.end = endOffset;
  this.filePosition = null;
}
 
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:10,代码来源:LineRecordReader.java


注:本文中的org.apache.hadoop.mapreduce.lib.input.SplitLineReader类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。