List of usage examples for org.apache.hadoop.mapreduce.lib.input LineRecordReader LineRecordReader
public LineRecordReader(byte[] recordDelimiter)
From source file:com.cloudera.bigdata.analysis.dataload.io.SplitableInputFormat.java
License:Apache License
@Override public RecordReader<LongWritable, Text> createRecordReader(InputSplit split, TaskAttemptContext context) { String delimiter = context.getConfiguration().get(DELIMITER); String encoding = context.getConfiguration().get(ENCODING); String className = context.getConfiguration().get(RECORD_READER, "org.apache.hadoop.mapreduce.lib.input.LineRecordReader"); byte[] recordDelimiterBytes = null; if (null != delimiter) recordDelimiterBytes = delimiter.getBytes(); // Here is the reader to do the real split. SplitableRecordReader recorder;/*ww w .j a va 2 s . co m*/ try { Class<? extends SplitableRecordReader> recordClass = (Class<? extends SplitableRecordReader>) Class .forName(className); recorder = recordClass.newInstance(); } catch (Exception e) { LOG.error("Unable to create instance of class " + className.toString(), e); return new LineRecordReader(recordDelimiterBytes); } if (encoding != null) { recorder.setEncoding(encoding); } if (delimiter != null) { recorder.setRecordDelimiterBytes(recordDelimiterBytes); } return recorder; }
From source file:com.conductor.s3.S3TextInputFormat.java
License:Apache License
@Override public RecordReader<LongWritable, Text> createRecordReader(InputSplit split, TaskAttemptContext context) { final String delimiter = context.getConfiguration().get("textinputformat.record.delimiter"); return new LineRecordReader(delimiter != null ? delimiter.getBytes() : null); }
From source file:com.sourcecode.TextInputFormat.java
License:Apache License
@Override public RecordReader<LongWritable, Text> createRecordReader(InputSplit split, TaskAttemptContext context) { String delimiter = context.getConfiguration().get("textinputformat.record.delimiter"); byte[] recordDelimiterBytes = null; if (null != delimiter) recordDelimiterBytes = delimiter.getBytes(Charsets.UTF_8); return new LineRecordReader(recordDelimiterBytes); }