public void embedClassesDirectory()

in src/main/java/org/apache/sling/testing/teleporter/client/ClientSideTeleporter.java [229:249]


    public void embedClassesDirectory(File classesDirectory) throws IOException, ClassNotFoundException {
        final Path start = classesDirectory.toPath();
        Files.walkFileTree(start, new SimpleFileVisitor<Path>() {
            @Override
            public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
                    throws IOException {
                if (file.getFileName().toString().endsWith(".class")) {
                    String className = start.relativize(file).toString().replace(file.getFileSystem().getSeparator(), ".");
                    // strip off extension
                    className = className.substring(0, className.length() - 6);
                    try {
                        Class<?> clazz = this.getClass().getClassLoader().loadClass(className);
                        embedClass(clazz);
                    } catch (ClassNotFoundException e) {
                        throw new IOException("Could not load class with name '" + className + "'", e);
                    }
                }
                return FileVisitResult.CONTINUE;
            }
        });
    }