try {
Files.createParentDirs(workFile);
JsonWriter writer =
new JsonWriter(new OutputStreamWriter(new FileOutputStream(workFile), Charsets.UTF_8));
writer.setIndent(" "); // always pretty print
writer.beginArray();
this.writer = Optional.of(writer);
} catch (IOException e) {
logger.log(SEVERE, String.format(
"An error occured writing trial %s. Results in %s will be incomplete.", trial.id(),
resultFile), e);