protected List<JavaFileObject> listClassesFromUrl(URL base, String packageName) throws IOException {
        //TODO this will only work with file:// not jar://

        if (base == null) {
            throw new NullPointerException("base == null");
        }

        List<JavaFileObject> list = new ArrayList<JavaFileObject>();

        URLConnection connection = base.openConnection();
        connection.connect();
        String encoding = connection.getContentEncoding();
        if (encoding == null) {
            encoding = "UTF-8";
        }
        BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream(), encoding));
        try {
            String curLine;
            do {
                curLine = reader.readLine();
                if (curLine != null && curLine.endsWith(".class")) {
                    try {
                        String curSimpleName = curLine.substring(0, curLine.length() - ".class".length());
                        String binaryName;
                        if (packageName == null) {
                            binaryName = curSimpleName;
                        } else {
                            binaryName = packageName + "." + curSimpleName;
                        }
                        list.add(new UrlJavaFileObject(curLine, new URL(base, curLine), Kind.CLASS, binaryName));
                    } catch (URISyntaxException e) {
                        throw new IOException("Error parsing URL " + curLine + ".", e);
                    }
                }
            } while (curLine != null);
        } finally {
            reader.close();
        }
        return list;
    }