@NonNull @Override public Collection<String> toComment(@NonNull Collection<String> lines) { return delegate.toComment(lines); }
@Override public void save(@NonNull ConfigurationNode node) throws IOException { if (sink == null) { throw new IOException("No sink present to write to!"); } try (Writer writer = sink.call()) { if (headerMode != HeaderMode.NONE) { String header = node.getOptions().getHeader(); if (header != null && !header.isEmpty()) { for (String line : getDefaultCommentHandler().toComment(ImmutableList.copyOf(LINE_SPLITTER.split(header)))) { writer.write(line); writer.write(SYSTEM_LINE_SEPARATOR); } writer.write(SYSTEM_LINE_SEPARATOR); } } saveInternal(node, writer); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } else { throw new IOException(e); } } }
@Override public void save(ConfigurationNode node) throws IOException { if (!canSave()) { throw new IOException("No sink present to write to!"); } try (Writer writer = sink.call()) { if (headerMode != HeaderMode.NONE) { String header = node.getOptions().getHeader(); if (header != null && !header.isEmpty()) { for (String line : getDefaultCommentHandler().toComment(ImmutableList.copyOf(LINE_SPLITTER.split(header)))) { writer.write(line); writer.write(SYSTEM_LINE_SEPARATOR); } writer.write(SYSTEM_LINE_SEPARATOR); } } saveInternal(node, writer); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } else { throw new IOException(e); } } }
@Override public void save(@NonNull ConfigurationNode node) throws IOException { if (sink == null) { throw new IOException("No sink present to write to!"); } try (Writer writer = sink.call()) { writeHeaderInternal(writer); if (headerMode != HeaderMode.NONE) { String header = node.getOptions().getHeader(); if (header != null && !header.isEmpty()) { for (String line : getDefaultCommentHandler().toComment(ImmutableList.copyOf(LINE_SPLITTER.split(header)))) { writer.write(line); writer.write(SYSTEM_LINE_SEPARATOR); } writer.write(SYSTEM_LINE_SEPARATOR); } } saveInternal(node, writer); } catch (Exception e) { if (e instanceof IOException) { throw (IOException) e; } else { throw new IOException(e); } } }