@Override public String getName(P path) { return filtered.getName(path); }
private <P> void assertFS(ReadFileSystem<P> fs) throws Exception { assertEquals("", fs.getName(fs.getRoot())); assertEquals(Collections.emptyList(), fs.getNames(fs.getRoot())); assertEquals("foo", fs.getName(foo)); HashSet<? extends P> fooChildren = Tools.set(fs.getChildren(foo)); assertEquals(2, fooChildren.size()); assertEquals("bar.txt", fs.getName(fooBarTxt)); assertTrue(fs.isFile(fooBarTxt)); URL fooBarTxtURL = fs.getURL(fooBarTxt); assertEquals("bar", fs.getName(fooBar)); assertTrue(fs.isDir(fooBar)); assertEquals("juu.txt", fs.getName(fooBarJuu)); URL fooBarJuuURL = fs.getURL(fooBarJuu); String fooBarJuuContent = Tools.read(fooBarJuuURL);
@Override public String getName(P path) { return filtered.getName(path); }
private <P> void assertFS(ReadFileSystem<P> fs) throws Exception { assertEquals("", fs.getName(fs.getRoot())); assertEquals(Collections.emptyList(), fs.getNames(fs.getRoot())); assertEquals("foo", fs.getName(foo)); HashSet<? extends P> fooChildren = Tools.set(fs.getChildren(foo)); assertEquals(2, fooChildren.size()); assertEquals("bar.txt", fs.getName(fooBarTxt)); assertTrue(fs.isFile(fooBarTxt)); URL fooBarTxtURL = fs.getURL(fooBarTxt); assertEquals("bar", fs.getName(fooBar)); assertTrue(fs.isDir(fooBar)); assertEquals("juu.txt", fs.getName(fooBarJuu)); URL fooBarJuuURL = fs.getURL(fooBarJuu); String fooBarJuuContent = Tools.read(fooBarJuuURL);
public boolean hasNext() { try { while (next == null && i.hasNext()) { P path = i.next(); String name = filtered.getName(path); next = get(name, path); } return next != null; } catch (IOException e) { throw new UndeclaredIOException(e); } } public P next() {
public boolean hasNext() { try { while (next == null && i.hasNext()) { P path = i.next(); String name = filtered.getName(path); next = get(name, path); } return next != null; } catch (IOException e) { throw new UndeclaredIOException(e); } } public P next() {
@Override public P getRoot() throws IOException { P root = filtered.getRoot(); String name = filtered.getName(root); if (filter.acceptDir(root, name)) { return root; } else { throw new IOException("Cannot access root"); } }
@Override public P getRoot() throws IOException { P root = filtered.getRoot(); String name = filtered.getName(root); if (filter.acceptDir(root, name)) { return root; } else { throw new IOException("Cannot access root"); } }
private void list( String packageName, P root, Set<JavaFileObject.Kind> kinds, boolean recurse, Collection<JavaFileObject> to) throws IOException { for (Iterator<P> i = fs.getChildren(root);i.hasNext();) { P child = i.next(); if (fs.isDir(child)) { if (recurse) { String name = fs.getName(child); list(packageName.isEmpty() ? name : packageName + "." + name, child, kinds, true, to); } } else { String name = fs.getName(child); FileKey key = FileKey.newName(packageName, name); if (kinds.contains(key.getKind())) { to.add(getReadable(key)); } } } } }
private void list( String packageName, P root, Set<JavaFileObject.Kind> kinds, boolean recurse, Collection<JavaFileObject> to) throws IOException { for (Iterator<P> i = fs.getChildren(root);i.hasNext();) { P child = i.next(); if (fs.isDir(child)) { if (recurse) { String name = fs.getName(child); list(packageName.isEmpty() ? name : packageName + "." + name, child, kinds, true, to); } } else { String name = fs.getName(child); FileKey key = FileKey.newName(packageName, name); if (kinds.contains(key.getKind())) { to.add(getReadable(key)); } } } } }
while (children.hasNext()) { Object child = children.next(); String name = compound.getName(child); add(name).paths[i] = child;
while (children.hasNext()) { Object child = children.next(); String name = compound.getName(child); add(name).paths[i] = child;
public final void traverse(P path, Filter<P> filter, Visitor<P> visitor) throws IOException { String name = getName(path); if (isDir(path)) { if (filter.acceptDir(path, name)) { visitor.enterDir(path, name); for (Iterator<P> i = getChildren(path);i.hasNext();) { P child = i.next(); traverse(child, filter, visitor); } visitor.leaveDir(path, name); } } else if (filter.acceptFile(path, name)) { visitor.file(path, name); } }
public final void traverse(P path, Filter<P> filter, Visitor<P> visitor) throws IOException { String name = getName(path); if (isDir(path)) { if (filter.acceptDir(path, name)) { visitor.enterDir(path, name); for (Iterator<P> i = getChildren(path);i.hasNext();) { P child = i.next(); traverse(child, filter, visitor); } visitor.leaveDir(path, name); } } else if (filter.acceptFile(path, name)) { visitor.file(path, name); } }
assertEquals("", fs.getName(root)); Iterator<P> rootChildren = fs.getChildren(root); assertTrue(rootChildren.hasNext()); assertEquals("compiler", fs.getName(compiler)); Iterator<P> compilerChildren = fs.getChildren(compiler); assertTrue(compilerChildren.hasNext()); assertEquals("disk", fs.getName(disk)); Iterator<P> diskChildren = fs.getChildren(disk); assertTrue(diskChildren.hasNext()); assertEquals("A.java", fs.getName(a));
assertEquals("", fs.getName(root)); Iterator<P> rootChildren = fs.getChildren(root); assertTrue(rootChildren.hasNext()); assertEquals("compiler", fs.getName(compiler)); Iterator<P> compilerChildren = fs.getChildren(compiler); assertTrue(compilerChildren.hasNext()); assertEquals("disk", fs.getName(disk)); Iterator<P> diskChildren = fs.getChildren(disk); assertTrue(diskChildren.hasNext()); assertEquals("A.java", fs.getName(a));