Class 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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 null
        java.lang.IllegalArgumentException - if regex is empty
        java.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 interface CommentMatcher
        Parameters:
        line - the raw line of CSV
        Returns:
        true if it's a comment, otherwise false