use of org.yaml.snakeyaml.DumperOptions in project watson by totemo.
the class ChatHighlighter method saveHighlights.
// loadHighlights
// --------------------------------------------------------------------------
/**
* Save the highlights to the configuration file.
*/
public void saveHighlights() {
try {
File file = new File(Controller.getModDirectory(), CHAT_HIGHLIGHTS_FILE);
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
try {
ArrayList<Object> highlights = new ArrayList<Object>();
for (Highlight hl : _highlights) {
highlights.add(hl.getSaveData());
}
HashMap<String, Object> root = new HashMap<String, Object>();
root.put("highlights", highlights);
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Yaml yaml = new Yaml(options);
yaml.dump(root, writer);
} finally {
writer.close();
}
} catch (Exception ex) {
Log.exception(Level.SEVERE, "error saving chat highlights: ", ex);
}
}
Aggregations