public final P getPath(P from, Iterable<String> names) throws IOException { for (String name : names) { if (isDir(from)) { P child = getChild(from, name); if (child != null) { from = child; } else { return null; } } else { throw new UnsupportedOperationException("handle me gracefully : was expecting " + Tools.list(names) + " to resolve"); } } return from; }
public final P getPath(P from, Iterable<String> names) throws IOException { for (String name : names) { if (isDir(from)) { P child = getChild(from, name); if (child != null) { from = child; } else { return null; } } else { throw new UnsupportedOperationException("handle me gracefully : was expecting " + Tools.list(names) + " to resolve"); } } return from; }
private P get(String name, P child) throws IOException { if (filtered.isDir(child)) { if (filter.acceptDir(child, name)) { return child; } else { return null; } } else { if (filter.acceptFile(child, name)) { return child; } else { return null; } } } }
private P get(String name, P child) throws IOException { if (filtered.isDir(child)) { if (filter.acceptDir(child, name)) { return child; } else { return null; } } else { if (filter.acceptFile(child, name)) { return child; } else { return null; } } } }
@Override public <C extends Collection<JavaFileObject>> C list( String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse, C to) throws IOException { Iterable<String> packageNames = Spliterator.split(packageName, '.'); P dir = fs.getPath(packageNames); if (dir != null && fs.isDir(dir)) { list(packageName, dir, kinds, recurse, to); } return to; }
@Override public <C extends Collection<JavaFileObject>> C list( String packageName, Set<JavaFileObject.Kind> kinds, boolean recurse, C to) throws IOException { Iterable<String> packageNames = Spliterator.split(packageName, '.'); P dir = fs.getPath(packageNames); if (dir != null && fs.isDir(dir)) { list(packageName, dir, kinds, recurse, to); } return to; }
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)); } } } } }
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); } }
private <D> int kind(P srcPath, ReadWriteFileSystem<D> dst, D dstPath) throws IOException { if (isDir(srcPath)) { if (dst.isDir(dstPath)) { return 1; } else if (dst.isFile(dstPath)) { return 2; } else { return 1; } } else if (isFile(srcPath)) { if (dst.isFile(dstPath)) { return 0; } else if (dst.isDir(dstPath)) { return 3; } else { return 0; } } else { return 4; } }
private <D> int kind(P srcPath, ReadWriteFileSystem<D> dst, D dstPath) throws IOException { if (isDir(srcPath)) { if (dst.isDir(dstPath)) { return 1; } else if (dst.isFile(dstPath)) { return 2; } else { return 1; } } else if (isFile(srcPath)) { if (dst.isFile(dstPath)) { return 0; } else if (dst.isDir(dstPath)) { return 3; } else { return 0; } } else { return 4; } }
D a = dst.getChild(dstPath, name); if (a == null) { boolean dir = isDir(next); boolean accept = dir ? filter.acceptDir(next, name) : filter.acceptFile(next, name); if (accept) {
D a = dst.getChild(dstPath, name); if (a == null) { boolean dir = isDir(next); boolean accept = dir ? filter.acceptDir(next, name) : filter.acceptFile(next, name); if (accept) {
assertTrue(fs.isDir(root)); assertFalse(fs.isFile(root)); assertEquals("", fs.getName(root)); assertTrue(fs.isDir(compiler)); assertFalse(fs.isFile(compiler)); assertEquals("compiler", fs.getName(compiler)); assertTrue(fs.isDir(disk)); assertFalse(fs.isFile(disk)); assertEquals("disk", fs.getName(disk)); assertFalse(fs.isDir(a)); assertTrue(fs.isFile(a)); assertEquals("A.java", fs.getName(a));
assertTrue(fs.isDir(root)); assertFalse(fs.isFile(root)); assertEquals("", fs.getName(root)); assertTrue(fs.isDir(compiler)); assertFalse(fs.isFile(compiler)); assertEquals("compiler", fs.getName(compiler)); assertTrue(fs.isDir(disk)); assertFalse(fs.isFile(disk)); assertEquals("disk", fs.getName(disk)); assertFalse(fs.isDir(a)); assertTrue(fs.isFile(a)); assertEquals("A.java", fs.getName(a));
assertTrue(fooChildren.contains(fooBar)); assertEquals("bar", fs.getName(fooBar)); assertTrue(fs.isDir(fooBar));
assertTrue(fooChildren.contains(fooBar)); assertEquals("bar", fs.getName(fooBar)); assertTrue(fs.isDir(fooBar));