String[] patternComponents = pattern.toUri().getPath().split(Path.SEPARATOR);
if (pathComponents.length < patternComponents.length) {
return false;
}
for (int i = 0; i < patternComponents.length; i++) {
GlobFilter fp = new GlobFilter(patternComponents[i], null);
if (!fp.hasPattern()) {
if (!patternComponents[i].equals(pathComponents[i])) {
return false;
}
} else {
if (!fp.accept(pathComponents[i])) {
return false;
}
}
}
return true;