當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。