当前位置: 首页>>代码示例>>Java>>正文


Java FileSystem.getPathMatcher方法代码示例

本文整理汇总了Java中java.nio.file.FileSystem.getPathMatcher方法的典型用法代码示例。如果您正苦于以下问题:Java FileSystem.getPathMatcher方法的具体用法?Java FileSystem.getPathMatcher怎么用?Java FileSystem.getPathMatcher使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.nio.file.FileSystem的用法示例。


在下文中一共展示了FileSystem.getPathMatcher方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleMessage

import java.nio.file.FileSystem; //导入方法依赖的package包/类
private void handleMessage(CtrlRequest payload) throws JsonProcessingException {
    RouteMessage message = new RouteMessage(
            payload.getData(), payload.getCorrelationId(), topologyName);
    List<Object> packedMessage = message.pack();

    String glob = payload.getRoute();

    if (Strings.isNullOrEmpty(glob)) {
        glob = "**";
    } else if (glob.equals("*")) {
        glob = "**";
    }

    FileSystem fs = FileSystems.getDefault();
    PathMatcher matcher = fs.getPathMatcher("glob:" + glob);

    for (String bolt : endpoints.keySet()) {
        Path route = fs.getPath(topologyName, bolt);

        if (! matcher.matches(route)) {
            continue;
        }

        getOutputCollector().emit(
                endpoints.get(bolt), getTuple(), packedMessage);
    }
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:28,代码来源:RouteAction.java

示例2: addPattern

import java.nio.file.FileSystem; //导入方法依赖的package包/类
private static void addPattern(final String fileNameGlobPattern, final List<PathMatcher> matchers) {
    if (fileNameGlobPattern.contains("/")) {
        throw new IllegalArgumentException("cannot contain '/'");
    }
    final FileSystem fs = FileSystems.getDefault();
    final PathMatcher matcher = fs.getPathMatcher(GLOB_SYNTAX + fileNameGlobPattern);
    matchers.add(matcher);
}
 
开发者ID:openweb-nl,项目名称:hippo-groovy-updater,代码行数:9,代码来源:GlobFileNameMatcher.java

示例3: include

import java.nio.file.FileSystem; //导入方法依赖的package包/类
public void include(final String osNameGlobPattern) {
    if (osNameGlobPattern.contains("/")) {
        throw new IllegalArgumentException("OS name pattern cannot contain '/'");
    }

    final FileSystem fs = FileSystems.getDefault();

    final PathMatcher includeOsNames = fs.getPathMatcher(GLOB_SYNTAX + osNameGlobPattern);
    included.add(includeOsNames);
}
 
开发者ID:openweb-nl,项目名称:hippo-groovy-updater,代码行数:11,代码来源:OsNameMatcher.java

示例4: getPathMatcher

import java.nio.file.FileSystem; //导入方法依赖的package包/类
public static PathMatcher getPathMatcher(FileSystem fs, String pattern) {
    if (!pattern.startsWith("glob:") && !pattern.startsWith("regex:")) {
        pattern = "glob:" + pattern;
    }

    return fs.getPathMatcher(pattern);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:8,代码来源:Utils.java

示例5: testGlobPathMatcher

import java.nio.file.FileSystem; //导入方法依赖的package包/类
@Test(dataProvider = "pathGlobPatterns")
public void testGlobPathMatcher(String pattern, String path,
        boolean expectMatch) throws Exception {
    FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
    PathMatcher pm = fs.getPathMatcher("glob:" + pattern);
    Path p = fs.getPath(path);
    assertTrue(Files.exists(p), path);
    assertTrue(!(pm.matches(p) ^ expectMatch),
        p + (expectMatch? " should match " : " should not match ") +
        pattern);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:Basic.java

示例6: testRegexPathMatcher

import java.nio.file.FileSystem; //导入方法依赖的package包/类
@Test(dataProvider = "pathRegexPatterns")
public void testRegexPathMatcher(String pattern, String path,
        boolean expectMatch) throws Exception {
    FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
    PathMatcher pm = fs.getPathMatcher("regex:" + pattern);
    Path p = fs.getPath(path);
    assertTrue(Files.exists(p), path);
    assertTrue(!(pm.matches(p) ^ expectMatch),
        p + (expectMatch? " should match " : " should not match ") +
        pattern);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:12,代码来源:Basic.java

示例7: GlobPathSet

import java.nio.file.FileSystem; //导入方法依赖的package包/类
public GlobPathSet(final String rootPathString, final String pattern, final FileTreeWalker fileTreeWalker, final FileSystem fileSystem) {
    this.rootPath = fileSystem.getPath(checkNotNull(rootPathString)).toAbsolutePath();
    this.pattern = pattern;
    this.fileTreeWalker = fileTreeWalker;
    this.matcher = fileSystem.getPathMatcher(buildGlobPattern(fileSystem, rootPath, pattern));
}
 
开发者ID:DevOpsStudio,项目名称:Re-Collector,代码行数:7,代码来源:GlobPathSet.java


注:本文中的java.nio.file.FileSystem.getPathMatcher方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。