/** * Indicates whether the given canonical path matches the given Ant-style * pattern * * @param antPattern the pattern to check against (can't be blank) * @param canonicalPath the path to check (can't be blank) * @return see above * @deprecated use {@link FileUtils#matchesAntPath(String, String)} instead */ @Deprecated public static boolean matchesAntPath(final String antPattern, final String canonicalPath) { return FileUtils.matchesAntPath(antPattern, canonicalPath); }
/** * Indicates whether this file's canonical path matches the given Ant-style * pattern. * <p> * The presented path must be in Ant syntax. It should include a full prefix * that is consistent with the {@link #getCanonicalPath()} method. * * @param antPattern the pattern to check this file against (cannot be * blank) * @return whether the path matches or not */ public boolean matchesAntPath(final String antPattern) { return FileUtils.matchesAntPath(antPattern, getCanonicalPath()); }
if (FileUtils.matchesAntPath(antPath, f.getCanonicalPath())) { result.add(new FileDetails(f, f.lastModified()));
private boolean isWithin(final MonitoringRequest request, final String filePath) { String requestCanonicalPath; try { requestCanonicalPath = request.getFile().getCanonicalPath(); } catch (final IOException e) { return false; } if (request instanceof DirectoryMonitoringRequest) { final DirectoryMonitoringRequest dmr = (DirectoryMonitoringRequest) request; if (dmr.isWatchSubtree()) { if (!filePath.startsWith(requestCanonicalPath)) { // Not within this directory or as ub-directory return false; } } else { if (!FileUtils.matchesAntPath(requestCanonicalPath + File.separator + "*", filePath)) { return false; // Not within this directory } } } else { if (!requestCanonicalPath.equals(filePath)) { return false; // Not a file } } return true; }
/** * Indicates whether the given canonical path matches the given Ant-style * pattern * * @param antPattern the pattern to check against (can't be blank) * @param canonicalPath the path to check (can't be blank) * @return see above * @deprecated use {@link FileUtils#matchesAntPath(String, String)} instead */ @Deprecated public static boolean matchesAntPath(final String antPattern, final String canonicalPath) { return FileUtils.matchesAntPath(antPattern, canonicalPath); }
/** * Indicates whether this file's canonical path matches the given Ant-style * pattern. * <p> * The presented path must be in Ant syntax. It should include a full prefix * that is consistent with the {@link #getCanonicalPath()} method. * * @param antPattern the pattern to check this file against (cannot be * blank) * @return whether the path matches or not */ public boolean matchesAntPath(final String antPattern) { return FileUtils.matchesAntPath(antPattern, getCanonicalPath()); }
if (FileUtils.matchesAntPath(antPath, f.getCanonicalPath())) { result.add(new FileDetails(f, f.lastModified()));
if (FileUtils.matchesAntPath(antPath, f.getCanonicalPath())) { result.add(new FileDetails(f, f.lastModified()));
private boolean isWithin(final MonitoringRequest request, final String filePath) { String requestCanonicalPath; try { requestCanonicalPath = request.getFile().getCanonicalPath(); } catch (final IOException e) { return false; } if (request instanceof DirectoryMonitoringRequest) { final DirectoryMonitoringRequest dmr = (DirectoryMonitoringRequest) request; if (dmr.isWatchSubtree()) { if (!filePath.startsWith(requestCanonicalPath)) { // Not within this directory or as ub-directory return false; } } else { if (!FileUtils.matchesAntPath(requestCanonicalPath + File.separator + "*", filePath)) { return false; // Not within this directory } } } else { if (!requestCanonicalPath.equals(filePath)) { return false; // Not a file } } return true; }
if (!FileUtils.matchesAntPath(requestCanonicalPath + File.separator + "*", filePath)) { return false; // Not within this directory