tech.kronicle.utils.AntStyleIgnoreFileLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kronicle-utils Show documentation
Show all versions of kronicle-utils Show documentation
Kronicle utils library that contains utility classes for use by Kronicle and its plugins
package tech.kronicle.utils;
import java.util.List;
import java.util.function.Predicate;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
public class AntStyleIgnoreFileLoader {
// "\\R" matches any Unicode line-break sequence on Java 8+
private static final Pattern LINE_BREAK_PATTERN = Pattern.compile("\\R");
private static final Pattern COMMENT_LINE_PATTERN = Pattern.compile("^\\s*#");
private static final Pattern EMPTY_LINE_PATTERN = Pattern.compile("^\\s*$");
public static final Predicate NOT_COMMENT_LINE = Predicate.not(COMMENT_LINE_PATTERN.asPredicate());
public static final Predicate NOT_EMPTY_LINE = Predicate.not(EMPTY_LINE_PATTERN.asPredicate());
public List load(String content) {
return LINE_BREAK_PATTERN.splitAsStream(content)
.filter(NOT_COMMENT_LINE)
.filter(NOT_EMPTY_LINE)
.collect(Collectors.toUnmodifiableList());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy