Package java.nio.file

Examples of java.nio.file.PathMatcher.matches()


    Assert.assertFalse(FileSystems.getDefault().getPathMatcher("glob:**.{html,xml}").matches(pFile1Txt));
   
    // Complex Matches
    PathMatcher pm2 = FileSystems.getDefault().getPathMatcher("glob:**/sub/sub[A-F]ile?.{txt,bak}");
    Assert.assertFalse(pm2.matches(pFile1Txt));
    Assert.assertTrue(pm2.matches(pSubFile1Txt));
  }
 
  private static class SuppressedExceptionTest implements AutoCloseable {
    private String closeExceptionMsg;
   
View Full Code Here


        final PathMatcher matcher = FileSystems.getDefault().getPathMatcher("glob:**");
         DirectoryStream.Filter<Path> filter = new DirectoryStream.Filter<Path>() {
            @Override
            public boolean accept(Path entry)  {
                return matcher.matches(entry.getFileName());
            }
        };

        if(starPattern.matcher(searchArgument).matches()) {
            try (DirectoryStream<Path> stream = findDirectory ?
View Full Code Here

    @Test
    public void testLogical() {
        PathMatcher matcher = Logical.parse("log:(org/{apache,foo}/** or **) and(not **example**)");

        assertTrue(matcher.matches(Paths.get("org/foo/foo.java")));
        assertFalse(matcher.matches(Paths.get("org/foo/example.java")));
    }

    @Test
    public void testMavenGroupId() {
View Full Code Here

    @Test
    public void testLogical() {
        PathMatcher matcher = Logical.parse("log:(org/{apache,foo}/** or **) and(not **example**)");

        assertTrue(matcher.matches(Paths.get("org/foo/foo.java")));
        assertFalse(matcher.matches(Paths.get("org/foo/example.java")));
    }

    @Test
    public void testMavenGroupId() {
        PathMatcher matcher = Maven.parse("mvn:groupId:org.apache,org.foo");
View Full Code Here

    @Test
    public void testMavenGroupId() {
        PathMatcher matcher = Maven.parse("mvn:groupId:org.apache,org.foo");

        assertTrue(matcher.matches(Paths.get("org")));
        assertTrue(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertTrue(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/jboss")));
View Full Code Here

    @Test
    public void testMavenGroupId() {
        PathMatcher matcher = Maven.parse("mvn:groupId:org.apache,org.foo");

        assertTrue(matcher.matches(Paths.get("org")));
        assertTrue(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertTrue(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/jboss")));
        assertFalse(matcher.matches(Paths.get("org/jboss/foo.jar")));
View Full Code Here

    public void testMavenGroupId() {
        PathMatcher matcher = Maven.parse("mvn:groupId:org.apache,org.foo");

        assertTrue(matcher.matches(Paths.get("org")));
        assertTrue(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertTrue(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/jboss")));
        assertFalse(matcher.matches(Paths.get("org/jboss/foo.jar")));
        assertFalse(matcher.matches(Paths.get("com/jboss/foo.jar")));
View Full Code Here

        PathMatcher matcher = Maven.parse("mvn:groupId:org.apache,org.foo");

        assertTrue(matcher.matches(Paths.get("org")));
        assertTrue(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertTrue(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/jboss")));
        assertFalse(matcher.matches(Paths.get("org/jboss/foo.jar")));
        assertFalse(matcher.matches(Paths.get("com/jboss/foo.jar")));
    }
View Full Code Here

        assertTrue(matcher.matches(Paths.get("org")));
        assertTrue(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertTrue(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/jboss")));
        assertFalse(matcher.matches(Paths.get("org/jboss/foo.jar")));
        assertFalse(matcher.matches(Paths.get("com/jboss/foo.jar")));
    }
View Full Code Here

        assertTrue(matcher.matches(Paths.get("org")));
        assertTrue(matcher.matches(Paths.get("org/apache")));
        assertTrue(matcher.matches(Paths.get("org/apache/foo.jar")));
        assertTrue(matcher.matches(Paths.get("org/foo")));
        assertTrue(matcher.matches(Paths.get("org/foo/foo/bar.jar")));
        assertFalse(matcher.matches(Paths.get("org/jboss")));
        assertFalse(matcher.matches(Paths.get("org/jboss/foo.jar")));
        assertFalse(matcher.matches(Paths.get("com/jboss/foo.jar")));
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.