public SequenceFileAsTextRecordReader(Configuration conf, FileSplit split) throws IOException { sequenceFileRecordReader = new SequenceFileRecordReader<WritableComparable, Writable>(conf, split); innerKey = sequenceFileRecordReader.createKey(); innerValue = sequenceFileRecordReader.createValue(); }
@Override public synchronized void close() throws IOException { if(sequenceReader != null) { sequenceReader.close(); } }
/** * Return the progress within the input split * * @return 0.0 to 1.0 of the input byte range */ public float getProgress() throws IOException { return sequenceReader.getProgress(); }
private void resetDelegate() throws IOException { this.delegate = new SequenceFileRecordReader<BytesWritable, NullWritable>(conf, split); BytesWritable dummyValue = new BytesWritable(); for(int i=0; i<recordsRead; i++) { delegate.next(dummyValue, NullWritable.get()); } }
@Override public RecordReader<LongWritable, HarEntry> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { return new SequenceFileRecordReader<LongWritable, HarEntry>(job, (FileSplit)split); } }
/** Read key/value pair in a line. */ public synchronized boolean next(Text key, Text value) throws IOException { Text tKey = key; Text tValue = value; if (!sequenceFileRecordReader.next(innerKey, innerValue)) { return false; } tKey.set(innerKey.toString()); tValue.set(innerValue.toString()); return true; }
@Override public long getPos() throws IOException { return sfrr.getPos(); }
@SuppressWarnings("unchecked") public K createKey() { return (K) ReflectionUtils.newInstance(getKeyClass(), conf); }
@SuppressWarnings("unchecked") public V createValue() { return (V) ReflectionUtils.newInstance(getValueClass(), conf); }
public synchronized boolean next(K key, V value) throws IOException { if (!more) return false; long pos = in.getPosition(); boolean remaining = (in.next(key) != null); if (remaining) { getCurrentValue(value); } if (pos >= end && in.syncSeen()) { more = false; } else { more = remaining; } return more; }
@Override public RecordReader<LongWritable, HarEntry> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { return new SequenceFileRecordReader<LongWritable, HarEntry>(job, (FileSplit)split); } }
/** Read key/value pair in a line. */ public synchronized boolean next(Text key, Text value) throws IOException { Text tKey = key; Text tValue = value; if (!sequenceFileRecordReader.next(innerKey, innerValue)) { return false; } tKey.set(innerKey.toString()); tValue.set(innerValue.toString()); return true; }
public synchronized long getPos() throws IOException { return sequenceFileRecordReader.getPos(); }
@SuppressWarnings("unchecked") public K createKey() { return (K) ReflectionUtils.newInstance(getKeyClass(), conf); }
@SuppressWarnings("unchecked") public V createValue() { return (V) ReflectionUtils.newInstance(getValueClass(), conf); }
public synchronized boolean next(K key, V value) throws IOException { if (!more) return false; long pos = in.getPosition(); boolean remaining = (in.next(key) != null); if (remaining) { getCurrentValue(value); } if (pos >= end && in.syncSeen()) { more = false; } else { more = remaining; } return more; }
public SequenceFileAsTextRecordReader(Configuration conf, FileSplit split) throws IOException { sequenceFileRecordReader = new SequenceFileRecordReader<WritableComparable, Writable>(conf, split); innerKey = sequenceFileRecordReader.createKey(); innerValue = sequenceFileRecordReader.createValue(); }
/** {@inheritDoc} */ public RecordReader<Text, FileOperation> getRecordReader(InputSplit split, JobConf job, Reporter reporter) throws IOException { return new SequenceFileRecordReader<Text, FileOperation>(job, (FileSplit)split); } }
/** Read key/value pair in a line. */ public synchronized boolean next(Text key, Text value) throws IOException { Text tKey = key; Text tValue = value; if (!sequenceFileRecordReader.next(innerKey, innerValue)) { return false; } tKey.set(innerKey.toString()); tValue.set(innerValue.toString()); return true; }
@Override public synchronized void close() throws IOException { if(sequenceReader != null) { sequenceReader.close(); } }