Package com.ontology2.bakemono.primitiveTriples

Source Code of com.ontology2.bakemono.primitiveTriples.LineProcessingRecordReader

package com.ontology2.bakemono.primitiveTriples;

import java.io.IOException;

import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
import org.apache.hadoop.mapreduce.lib.input.LineRecordReader;

abstract class LineProcessingRecordReader<X> extends
        RecordReader<LongWritable, X> {
    private static org.apache.commons.logging.Log logger = LogFactory.getLog(LineProcessingRecordReader.class);
    LineRecordReader innerReader;

    public LineProcessingRecordReader() {
        innerReader=new LineRecordReader();
    }
   
    @Override
    public void initialize(InputSplit split, TaskAttemptContext context)
            throws IOException, InterruptedException {
        innerReader.initialize(split, context);
    }

    @Override
    public boolean nextKeyValue() throws IOException,
            InterruptedException {
        boolean b=innerReader.nextKeyValue();
        return b;
    }

    @Override
    public LongWritable getCurrentKey() throws IOException,
            InterruptedException {
        return innerReader.getCurrentKey();
    }

    @Override
    public X getCurrentValue() throws IOException,
            InterruptedException {
        Text line=innerReader.getCurrentValue();
        return convert(line);
    }

    abstract X convert(Text line);

    @Override
    public float getProgress() throws IOException, InterruptedException {
        return innerReader.getProgress();
    }

    @Override
    public void close() throws IOException {
        innerReader.close();
    }
}
TOP

Related Classes of com.ontology2.bakemono.primitiveTriples.LineProcessingRecordReader

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.