void () { if (getModel().isEmpty()) return; File file = getFile(myId); if (file == null) return; File dir = file.getParentFile(); if (dir == null || dir.exists() && !dir.isDirectory() || !dir.exists() && !dir.mkdirs()) { LOG.error("Unable to create " + file.getPath()); return; } try (Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(file), getCharset()))) { boolean first = true; for (String entry : getModel().getEntries()) { if (first) first = false; else out.write(myRootType.getEntrySeparator()); out.write(entry); } out.flush(); } catch (Exception ex) { LOG.error(ex); } }