title: using context object with in the run method of Mapper class in Map-reduce Hadoop?
body: <p>Here is the <a href="http://grepcode.com/file/repository.cloudera.com/content/repositories/releases/com.cloudera.hadoop/hadoop-core/0.20.2-737/org/apache/hadoop/mapreduce/Mapper.java#Mapper" rel="nofollow">source code</a> for Mapper </p>
  
  <pre><code>public void run(Context context) throws IOException, InterruptedException {
      setup(context);
      while (context.nextKeyValue()) {
        map(context.getCurrentKey(), context.getCurrentValue(), context);
      }
      cleanup(context);
    }
  }
  </code></pre>
  
  <p>As you can notice, <code>context</code> is used both for <code>read</code> and <code>write</code>. How is it possible?
  That is <code>context.getCurrentKey()</code> and <code>context.getCurrentValue()</code> are used to retrieve key and value pair from context and is passed to map function. Is it same <code>context</code> used for Input and Output?</p>