if(prefix == null) {
prefix = "map";
}
// setup output collector
FileOutputCollector collector = new FileOutputCollector(workDir, prefix);
// map all data
try {
for(File file : inputFiles) {
FileInputStream inputStream;
try {
inputStream = new FileInputStream(file);
BufferedReader br = new BufferedReader(new InputStreamReader(inputStream,
DataUtilDefaults.charSet));
// map data
String row;
while((row = br.readLine()) != null) {
mapper.map(row, collector);
}
inputStream.close();
} catch (IOException e) {
throw new DataUtilException(e);
} catch (MapReduceException e) {
throw new DataUtilException("Irrecoverable map operation", e);
}
}
} finally {
collector.close();
}
// return output files
return collector.getFiles();
}