public RecordWriter getRecordWriter( final FileSystem fs, JobConf job, String name, Progressable progress) throws IOException { final Path segmentDumpFile = new Path(job.getOutputPath(), name); // Get the old copy out of the way if (fs.exists(segmentDumpFile)) fs.delete(segmentDumpFile); final PrintStream printStream = new PrintStream(fs.create(segmentDumpFile)); return new RecordWriter() { public synchronized void write(WritableComparable key, Writable value) throws IOException { ObjectWritable writable = (ObjectWritable) value; printStream.println((String) writable.get()); } public synchronized void close(Reporter reporter) throws IOException { printStream.close(); } }; }