private final boolean[] sufficientFields;
private final boolean checkSufficientFields;
public WriteLineDocTask(PerfRunData runData) throws Exception {
super(runData);
Config config = runData.getConfig();
String fname = config.get("line.file.out", null);
if (fname == null) {
throw new IllegalArgumentException("line.file.out must be set");
}
OutputStream out = StreamUtils.outputStream(new File(fname));
lineFileOut = new PrintWriter(new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), StreamUtils.BUFFER_SIZE));
docMaker = runData.getDocMaker();
// init fields
String f2r = config.get("line.fields",null);
if (f2r == null) {
fieldsToWrite = DEFAULT_FIELDS;
} else {
if (f2r.indexOf(SEP)>=0) {
throw new IllegalArgumentException("line.fields "+f2r+" should not contain the separator char: "+SEP);
}
fieldsToWrite = f2r.split(",");
}
// init sufficient fields
sufficientFields = new boolean[fieldsToWrite.length];
String suff = config.get("sufficient.fields",DEFAULT_SUFFICIENT_FIELDS);
if (",".equals(suff)) {
checkSufficientFields = false;
} else {
checkSufficientFields = true;
HashSet<String> sf = new HashSet<String>(Arrays.asList(suff.split(",")));