private String readLineSkipComments()

in src/main/java/org/ini4j/spi/IniSource.java [183:223]


    private String readLineSkipComments() throws IOException
    {
        String line;
        StringBuilder comment = new StringBuilder();
        StringBuilder buff = new StringBuilder();

        for (line = _reader.readLine(); line != null; line = _reader.readLine())
        {
            line = line.trim();
            if (line.length() == 0)
            {
                handleComment(comment);
            }
            else if ((_commentChars.indexOf(line.charAt(0)) >= 0) && (buff.length() == 0))
            {
                comment.append(line.substring(1));
                comment.append(_config.getLineSeparator());
            }
            else
            {
                handleComment(comment);
                if (!_config.isEscapeNewline() || ((countEndingEscapes(line) & 1) == 0))
                {
                    buff.append(line);
                    line = buff.toString();

                    break;
                }

                buff.append(line.subSequence(0, line.length() - 1));
            }
        }

        // handle end comments
        if ((line == null) && (comment.length() != 0))
        {
            handleComment(comment);
        }

        return line;
    }