org.springframework.roo.support.util.FileUtils.matchesAntPath()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.5k)|赞(0)|评价(0)|浏览(94)

本文整理了Java中org.springframework.roo.support.util.FileUtils.matchesAntPath()方法的一些代码示例,展示了FileUtils.matchesAntPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtils.matchesAntPath()方法的具体详情如下:
包路径:org.springframework.roo.support.util.FileUtils
类名称:FileUtils
方法名:matchesAntPath

FileUtils.matchesAntPath介绍

[英]Indicates whether the given canonical path matches the given Ant-style pattern
[中]指示给定的规范路径是否与给定的Ant样式模式匹配

代码示例

代码示例来源:origin: spring-projects/spring-roo

/**
 * 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);
}

代码示例来源:origin: spring-projects/spring-roo

/**
 * 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());
}

代码示例来源:origin: spring-projects/spring-roo

if (FileUtils.matchesAntPath(antPath, f.getCanonicalPath())) {
 result.add(new FileDetails(f, f.lastModified()));

代码示例来源:origin: spring-projects/spring-roo

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;
}

代码示例来源:origin: org.springframework.roo/org.springframework.roo.file.monitor

/**
 * 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);
}

代码示例来源:origin: org.springframework.roo/org.springframework.roo.file.monitor

/**
 * 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());
}

代码示例来源:origin: org.springframework.roo/org.springframework.roo.file.monitor

if (FileUtils.matchesAntPath(antPath, f.getCanonicalPath())) {
 result.add(new FileDetails(f, f.lastModified()));

代码示例来源:origin: org.springframework.roo/org.springframework.roo.file.monitor.polling

if (FileUtils.matchesAntPath(antPath, f.getCanonicalPath())) {
  result.add(new FileDetails(f, f.lastModified()));

代码示例来源:origin: org.springframework.roo/org.springframework.roo.file.monitor

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;
}

代码示例来源:origin: org.springframework.roo/org.springframework.roo.file.monitor.polling

if (!FileUtils.matchesAntPath(requestCanonicalPath
    + File.separator + "*", filePath)) {
  return false; // Not within this directory

相关文章