Package java.net

Examples of java.net.URLClassLoader.findResources()


     * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
     */
    public void scanEpisodeFile(File jar) throws BadCommandLineException {
        try {
            URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
            Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                addBindFile(new InputSource(url.toExternalForm()));
            }
        } catch (IOException e) {
View Full Code Here


        Support_Resources.copyFile(resources, "JarIndex", "hyts_21.jar");
        Support_Resources.copyFile(resources, "JarIndex", "hyts_22.jar");
        Support_Resources.copyFile(resources, "JarIndex", "hyts_23.jar");
        urls[0] = new URL("file:/" + resPath + "/JarIndex/hyts_21.jar");
        ucl = URLClassLoader.newInstance(urls, null);
        Enumeration en = ucl.findResources("bpack/");

        boolean resourcesFound;
        try {
            resourcesFound = true;
            URL url1 = (URL) en.nextElement();
View Full Code Here

        // testing circular reference
        Support_Resources.copyFile(resources, "JarIndex", "hyts_41.jar");
        Support_Resources.copyFile(resources, "JarIndex", "hyts_42.jar");
        urls[0] = new URL("file:/" + resPath + "/JarIndex/hyts_41.jar");
        ucl = URLClassLoader.newInstance(urls, null);
        en = ucl.findResources("bpack/");
        resourcesFound = resourcesFound
                && ((URL) en.nextElement()).equals(new URL("jar:file:/"
                        + resPath.replace('\\', '/')
                        + "/JarIndex/hyts_42.jar!/bpack/"));
        assertTrue("Resources not found (2)", resourcesFound);
View Full Code Here

        Support_Resources.copyFile(resources, "JarIndex", "hyts_23.jar");

        URLClassLoader urlClassloader = URLClassLoader.newInstance(
                new URL[] { new URL("file:/" + resPath
                        + "/JarIndex/hyts_21.jar") }, null);
        Enumeration en = urlClassloader.findResources("bpack/");
        assertTrue(en.hasMoreElements());
        URL expected = new URL("jar:file:/" + resPath.replace('\\', '/')
                + "/JarIndex/hyts_22.jar!/bpack/");
        assertEquals(expected, (URL) en.nextElement());
        assertEquals(expected, urlClassloader.findResource("bpack/"));
View Full Code Here

     * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
     */
    public void scanEpisodeFile(File jar) throws BadCommandLineException {
        try {
            URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
            Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                addBindFile(new InputSource(url.toExternalForm()));
            }
        } catch (IOException e) {
View Full Code Here

        Support_Resources.copyFile(resources, "JarIndex", "hyts_21.jar");
        Support_Resources.copyFile(resources, "JarIndex", "hyts_22.jar");
        Support_Resources.copyFile(resources, "JarIndex", "hyts_23.jar");
        urls[0] = new URL("file:/" + resPath + "/JarIndex/hyts_21.jar");
        ucl = URLClassLoader.newInstance(urls, null);
        Enumeration en = ucl.findResources("bpack/");

        boolean resourcesFound;
        try {
            resourcesFound = true;
            URL url1 = (URL) en.nextElement();
View Full Code Here

        // testing circular reference
        Support_Resources.copyFile(resources, "JarIndex", "hyts_41.jar");
        Support_Resources.copyFile(resources, "JarIndex", "hyts_42.jar");
        urls[0] = new URL("file:/" + resPath + "/JarIndex/hyts_41.jar");
        ucl = URLClassLoader.newInstance(urls, null);
        en = ucl.findResources("bpack/");
        resourcesFound = resourcesFound
                && ((URL) en.nextElement()).equals(new URL("jar:file:/"
                        + resPath.replace('\\', '/')
                        + "/JarIndex/hyts_42.jar!/bpack/"));
        assertTrue("Resources not found (2)", resourcesFound);
View Full Code Here

        Support_Resources.copyFile(resources, "JarIndex", "hyts_23.jar");

        URLClassLoader urlClassloader = URLClassLoader.newInstance(
                new URL[] { new URL("file:/" + resPath
                        + "/JarIndex/hyts_21.jar") }, null);
        Enumeration en = urlClassloader.findResources("bpack/");
        assertTrue(en.hasMoreElements());
        URL expected = new URL("jar:file:/" + resPath.replace('\\', '/')
                + "/JarIndex/hyts_22.jar!/bpack/");
        assertEquals(expected, (URL) en.nextElement());
        assertEquals(expected, urlClassloader.findResource("bpack/"));
View Full Code Here

     * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
     */
    private void scanEpisodeFile(File jar) throws BadCommandLineException {
        try {
            URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
            Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                addBindFile(new InputSource(url.toExternalForm()));
            }
        } catch (IOException e) {
View Full Code Here

     * Finds the <tt>META-INF/sun-jaxb.episode</tt> file to add as a binding customization.
     */
    public void scanEpisodeFile(File jar) throws BadCommandLineException {
        try {
            URLClassLoader ucl = new URLClassLoader(new URL[]{jar.toURL()});
            Enumeration<URL> resources = ucl.findResources("META-INF/sun-jaxb.episode");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                addBindFile(new InputSource(url.toExternalForm()));
            }
        } catch (IOException e) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.