Last active
January 12, 2017 14:47
-
-
Save ldclakmal/2369ef060f0c5fc3859cffe97aa14e05 to your computer and use it in GitHub Desktop.
Check whether picked file matches with the given path pattern
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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