mainPlugin/src/main/java/org/simpleyaml/configuration/comments/YamlCommentDumper.java
/**
     * Merge comments from the comment mapper with lines from the reader.
     *
     * @return the resulting String
     * @throws IOException if any problem while reading arise
     */
Merge comments from the comment mapper with lines from the reader.
@return the resulting String
@throws IOException if any problem while reading arise
Merge comments from the comment mapper with lines from the reader . @return the resulting String @throws IOException if any problem while reading arise
public String dump() throws IOException {
        if (this.yamlCommentMapper == null) {
            return this.reader.lines().collect(Collectors.joining("\n"));
        }
        this.builder = new StringBuilder();
        while (this.nextLine()) {
            if (!this.isComment()) { 
                final String path = this.track().getPath();
                final KeyTree.Node node = this.getNode(path);
                this.append(node, KeyTree.Node::getComment);
                this.builder.append(this.currentLine);
                this.append(node, KeyTree.Node::getSideComment);
                this.builder.append('\n');
            }
        }
        this.append(this.getNode(null), KeyTree.Node::getComment);
        this.reader.close();
        return this.builder.toString();
    }
public String dump ( ) throws IOException { if ( this . yamlCommentMapper == null ) { return this . reader . lines ( ) . collect ( Collectors . joining ( "\n" ) ) ; } this . builder = new StringBuilder ( ) ; while ( this . nextLine ( ) ) { if ( ! this . isComment ( ) ) { final String path = this . track ( ) . getPath ( ) ; final KeyTree . Node node = this . getNode ( path ) ; this . append ( node , KeyTree . Node :: getComment ) ; this . builder . append ( this . currentLine ) ; this . append ( node , KeyTree . Node :: getSideComment ) ; this . builder . append ( '\n' ) ; } } this . append ( this . getNode ( null ) , KeyTree . Node :: getComment ) ; this . reader . close ( ) ; return this . builder . toString ( ) ; }
Merge comments from the comment mapper with lines from the reader.
Merge comments from the comment mapper with lines from the reader .
// Avoid duplicating header // Append end of file comment (null path), if found