source: proiecte/HadoopJUnit/hadoop-0.20.1/src/mapred/org/apache/hadoop/mapreduce/RecordReader.java @ 120

Last change on this file since 120 was 120, checked in by (none), 14 years ago

Added the mail files for the Hadoop JUNit Project

  • Property svn:executable set to *
File size: 2.6 KB
Line 
1/**
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *     http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18
19package org.apache.hadoop.mapreduce;
20
21import java.io.Closeable;
22import java.io.IOException;
23
24/**
25 * The record reader breaks the data into key/value pairs for input to the
26 * {@link Mapper}.
27 * @param <KEYIN>
28 * @param <VALUEIN>
29 */
30public abstract class RecordReader<KEYIN, VALUEIN> implements Closeable {
31
32  /**
33   * Called once at initialization.
34   * @param split the split that defines the range of records to read
35   * @param context the information about the task
36   * @throws IOException
37   * @throws InterruptedException
38   */
39  public abstract void initialize(InputSplit split,
40                                  TaskAttemptContext context
41                                  ) throws IOException, InterruptedException;
42
43  /**
44   * Read the next key, value pair.
45   * @return true if a key/value pair was read
46   * @throws IOException
47   * @throws InterruptedException
48   */
49  public abstract 
50  boolean nextKeyValue() throws IOException, InterruptedException;
51
52  /**
53   * Get the current key
54   * @return the current key or null if there is no current key
55   * @throws IOException
56   * @throws InterruptedException
57   */
58  public abstract
59  KEYIN getCurrentKey() throws IOException, InterruptedException;
60 
61  /**
62   * Get the current value.
63   * @return the object that was read
64   * @throws IOException
65   * @throws InterruptedException
66   */
67  public abstract 
68  VALUEIN getCurrentValue() throws IOException, InterruptedException;
69 
70  /**
71   * The current progress of the record reader through its data.
72   * @return a number between 0.0 and 1.0 that is the fraction of the data read
73   * @throws IOException
74   * @throws InterruptedException
75   */
76  public abstract float getProgress() throws IOException, InterruptedException;
77 
78  /**
79   * Close the record reader.
80   */
81  public abstract void close() throws IOException;
82}
Note: See TracBrowser for help on using the repository browser.