Package org.supercsv.comment
Class CommentMatches
- java.lang.Object
-
- org.supercsv.comment.CommentMatches
-
- All Implemented Interfaces:
CommentMatcher
public class CommentMatches extends java.lang.Object implements CommentMatcher
CommentMatcher that matches lines that match a specified regular expression.
-
-
Constructor Summary
Constructors Constructor Description CommentMatches(java.lang.String regex)
Constructs a new CommentMatches comment matcher.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isComment(java.lang.String line)
Determines whether a line of CSV is a comment.
-
-
-
Constructor Detail
-
CommentMatches
public CommentMatches(java.lang.String regex)
Constructs a new CommentMatches comment matcher. Ensure that the regex is efficient (ideally matching start/end characters) as a complex regex can significantly slow down reading.- Parameters:
regex
- the regular expression a line must match to be a comment- Throws:
java.lang.NullPointerException
- if regex is nulljava.lang.IllegalArgumentException
- if regex is emptyjava.util.regex.PatternSyntaxException
- if the regex is invalid
-
-
Method Detail
-
isComment
public boolean isComment(java.lang.String line)
Determines whether a line of CSV is a comment.- Specified by:
isComment
in interfaceCommentMatcher
- Parameters:
line
- the raw line of CSV- Returns:
- true if it's a comment, otherwise false
-
-