Skip to content

Instantly share code, notes, and snippets.

@ldclakmal
Last active January 12, 2017 14:47
Show Gist options
  • Select an option

  • Save ldclakmal/2369ef060f0c5fc3859cffe97aa14e05 to your computer and use it in GitHub Desktop.

Select an option

Save ldclakmal/2369ef060f0c5fc3859cffe97aa14e05 to your computer and use it in GitHub Desktop.
Check whether picked file matches with the given path pattern
public boolean isMatchPattern(GRPattern GRPattern, Path file) {
PathMatcher matcher = FileSystems.getDefault().getPathMatcher(GRPattern.getPatternSyntax() +
Paths.get(GRPattern.getPathPattern()).toString());
Path name = file.getFileName();
return name != null && matcher.matches(file);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment