in hadoop/src/main/java/org/tensorflow/hadoop/io/TFRecordFileOutputFormatV1.java [35:57]
public RecordWriter<BytesWritable, Writable> getRecordWriter(FileSystem ignored,
JobConf job, String name,
Progressable progress) throws IOException {
Path file = FileOutputFormat.getTaskOutputPath(job, name);
FileSystem fs = file.getFileSystem(job);
int bufferSize = TFRecordIOConf.getBufferSize(job);
final FSDataOutputStream fsdos = fs.create(file, true, bufferSize);
final TFRecordWriter writer = new TFRecordWriter(fsdos);
return new RecordWriter<BytesWritable, Writable>() {
@Override
public void write(BytesWritable key, Writable value)
throws IOException {
writer.write(key.getBytes(), 0, key.getLength());
}
@Override
public void close(Reporter reporter)
throws IOException {
fsdos.close();
}
};
}