@Test public void testAbsolute() throws Exception { GlobFileFinder gff = new GlobFileFinder(); List<Path> l1 = gff.find(tempDir.resolve("*").toString()); assertEquals(3, l1.size()); assertTrue(find(p_aa, l1)); assertTrue(find(p_a, l1)); assertTrue(find(p_b, l1)); List<Path> l2 = gff.find(tempDir.resolve("a*").toString()); assertEquals(2, l2.size()); assertTrue(find(p_aa, l2)); assertTrue(find(p_a, l2)); assertFalse(find(p_b, l2)); List<Path> l3 = gff.find(tempDir.resolve("c/*b*").toString()); assertEquals(3, l3.size()); assertTrue(find(p_c_abc, l3)); assertTrue(find(p_c_bbb, l3)); assertTrue(find(p_c_cbb, l3)); List<Path> l4 = gff.find(tempDir.resolve("c/[a-b]*").toString()); assertEquals(2, l4.size()); assertTrue(find(p_c_abc, l4)); assertTrue(find(p_c_bbb, l4)); }
public List<Path> find(String pattern) { result = new ArrayList<Path>(); ioCount = 0; Path patternPath = FileSystems.getDefault().getPath(pattern); List<Path> plist = new ArrayList<Path>(); patternPath.forEach(plist::add); ListIterator<Path> pitr = plist.listIterator(); if (pitr.hasNext()) { Path current = patternPath.isAbsolute() ? patternPath.getRoot() : FileSystems.getDefault().getPath(""); findMatchingFiles(current, pitr); } return result; }
GlobFileFinder { public List<Path> find(String pattern) { result = new ArrayList<Path>(); ioCount = 0; Path patternPath = FileSystems.getDefault().getPath(pattern); List<Path> plist = new ArrayList<Path>(); patternPath.forEach(plist::add); ListIterator<Path> pitr = plist.listIterator(); if (pitr.hasNext()) { Path current = patternPath.isAbsolute() ? patternPath.getRoot() : FileSystems.getDefault().getPath(""); findMatchingFiles(current, pitr); } return result; } }
GlobFileFinder { public List<Path> find(String pattern) { result = new ArrayList<Path>(); ioCount = 0; Path patternPath = FileSystems.getDefault().getPath(pattern); List<Path> plist = new ArrayList<Path>(); patternPath.forEach(plist::add); ListIterator<Path> pitr = plist.listIterator(); if (pitr.hasNext()) { Path current = patternPath.isAbsolute() ? patternPath.getRoot() : FileSystems.getDefault().getPath(""); findMatchingFiles(current, pitr); } return result; }  }
GlobFileFinder { public List<Path> find(String pattern) { result = new ArrayList<Path>(); ioCount = 0; Path patternPath = FileSystems.getDefault().getPath(pattern); List<Path> plist = new ArrayList<Path>(); patternPath.forEach(plist::add); ListIterator<Path> pitr = plist.listIterator(); if (pitr.hasNext()) { Path current = patternPath.isAbsolute() ? patternPath.getRoot() : FileSystems.getDefault().getPath(""); findMatchingFiles(current, pitr); } return result; }  List<Path> find(String pattern); void setIoLimit(int ioLimit); }
GlobFileFinder { public List<Path> find(String pattern) { result = new ArrayList<Path>(); ioCount = 0; Path patternPath = FileSystems.getDefault().getPath(pattern); List<Path> plist = new ArrayList<Path>(); patternPath.forEach(plist::add); ListIterator<Path> pitr = plist.listIterator(); if (pitr.hasNext()) { Path current = patternPath.isAbsolute() ? patternPath.getRoot() : FileSystems.getDefault().getPath(""); findMatchingFiles(current, pitr); } return result; }  List<Path> find(String pattern); void setIoLimit(int ioLimit);  }