1 /* Copyright (c) 2005 The Nutch Organization. All rights reserved. */ 2 /* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */ 3 4 package net.nutch.mapReduce; 5 6 import java.io.IOException; 7 import java.io.DataInput; 8 9 import net.nutch.io.Writable; 10 11 /** Reads key/value pairs from an input file {@link InputFormat.Split}. 12 * Implemented by {@link InputFormat} implementations. */ 13 public interface RecordReader { 14 15 /** Constructs a key suitable to pass as the first parameter to {@link 16 * #next(Writable,Writable)}. */ 17 Writable createKey(); 18 19 /** Constructs a value suitable to pass as the second parameter to {@link 20 * #next(Writable,Writable)}. */ 21 Writable createValue(); 22 23 /** Reads the next key/value pair. 24 * 25 * @param key the key to read data into 26 * @param value the value to read data into 27 * @return true iff a key/value was read, false if at EOF 28 * 29 * @see Writable#readFields(DataInput) 30 */ 31 boolean next(Writable key, Writable value) throws IOException; 32 } 33