code: public void map(WritableComparable key, Writable value, OutputCollector output, Reporter reporter) throws IOException {
      // init
      if (outThread_ == null) {
        startOutputThreads(output, reporter);
      }
      if (outerrThreadsThrowable != null) {
        mapRedFinished();
        throw new IOException ("MROutput/MRErrThread failed:"
                               + StringUtils.stringifyException(
                                                                outerrThreadsThrowable));
      }
      try {
        // 1/4 Hadoop in
        numRecRead_++;
        maybeLogRecord();
        if (debugFailDuring_ && numRecRead_ == 3) {
          throw new IOException("debugFailDuring_");
        }
  
        // 2/4 Hadoop to Tool
        if (numExceptions_ == 0) {
          if (!this.ignoreKey) {
            write(key);
            clientOut_.write('\t');
          }
          write(value);
          if(!this.skipNewline) {
              clientOut_.write('\n');
          }
          // clientOut_.flush();
        } else {
          numRecSkipped_++;
        }
      } catch (IOException io) {
        numExceptions_++;
        if (numExceptions_ > 1 || numRecWritten_ < minRecWrittenToEnableSkip_) {
          // terminate with failure
          String msg = logFailure(io);
          appendLogToJobLog("failure");
          mapRedFinished();
          throw new IOException(msg);
        } else {
          // terminate with success:
          // swallow input records although the stream processor failed/closed
        }
      }
    }
docs: (MapRed creates it reflectively)