Package java.net

Examples of java.net.URL.toURI()


                J2DoPrivHelper.getResourceAction(loader, rsrc + ".class"));
            if (url == null)
                return null;
        }
        try {
            _file = new File(url.toURI());
        } catch (URISyntaxException e) {
        } catch (IllegalArgumentException iae) {
            // this is thrown when the URI is non-hierarchical (aka JBoss)
        }
        return _file;
View Full Code Here


        List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
        String basePackageDirName = "/" + basePackage.replace('.', '/');
        URL location = VaadinSession.class.getResource(basePackageDirName);
        if (location.getProtocol().equals("file")) {
            try {
                File f = new File(location.toURI());
                if (!f.exists()) {
                    throw new IOException("Directory " + f.toString()
                            + " does not exist");
                }
                findPackages(f, basePackage, baseClass, classes,
View Full Code Here

        List<Class<? extends T>> classes = new ArrayList<Class<? extends T>>();
        String basePackageDirName = "/" + basePackage.replace('.', '/');
        URL location = baseClass.getResource(basePackageDirName);
        if (location.getProtocol().equals("file")) {
            try {
                File f = new File(location.toURI());
                if (!f.exists()) {
                    throw new IOException("Directory " + f.toString()
                            + " does not exist");
                }
                findPackages(f, basePackage, baseClass, classes,
View Full Code Here

        final URI GFSystemURI = GFSystemURI();
        final List<URL> result = classPathToURLs(System.getProperty("java.class.path"));
        for (ListIterator<URL> it = result.listIterator(); it.hasNext();) {
            final URL url = it.next();
            try {
                if (url.toURI().equals(GFSystemURI)) {
                    it.remove();
                }
            } catch (URISyntaxException ex) {
                throw new RuntimeException(ex);
            }
View Full Code Here

                J2DoPrivHelper.getResourceAction(loader, rsrc + ".class"));
            if (url == null)
                return null;
        }
        try {
            _file = new File(url.toURI());
        } catch (URISyntaxException e) {
        } catch (IllegalArgumentException iae) {
            // this is thrown when the URI is non-hierarchical (aka JBoss)
        }
        return _file;
View Full Code Here

    JarMain(String[] args) {
        this.args = args;
        URL mainClass = getClass().getResource(MAIN);
        try {
            this.path = mainClass.toURI().getSchemeSpecificPart();
        }
        catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }
        archive = this.path.replace("!" + MAIN, "").replace("file:", "");
View Full Code Here

  protected void setUpFile(final URL resourceURL, final String path) throws IOException {
    Assert.assertNotNull(resourceURL);
    final URL fileURL = FileLocator.toFileURL(resourceURL);
    File sourceRoot = null;
    try {
      URI _uRI = fileURL.toURI();
      File _file = new File(_uRI);
      sourceRoot = _file;
    } catch (final Throwable _t) {
      if (_t instanceof URISyntaxException) {
        final URISyntaxException e = (URISyntaxException)_t;
View Full Code Here

    private URI uri(String name) {
        URL resource = getClass().getResource(name);
        assertThat(name, resource, not(nullValue()));
        try {
            return resource.toURI();
        } catch (Exception e) {
            throw new AssertionError(e);
        }
    }
}
View Full Code Here

    }

    private URI uri(String file, String fragment) throws Exception {
        URL url = getClass().getResource(file);
        assertThat(file, url, not(nullValue()));
        URI resource = url.toURI();
        URI uri = new URI(
                resource.getScheme(),
                resource.getUserInfo(),
                resource.getHost(),
                resource.getPort(),
View Full Code Here

            throw new IllegalArgumentException(MessageFormat.format(
                    "指定されたリソースが見つかりません: {0} (検索クラス: {1})",
                    path,
                    getCallerClass().getName()));
        }
        URI resourceUri = url.toURI();
        if (uri.getFragment() == null) {
            return resourceUri;
        } else {
            URI resolvedUri = URI.create(resourceUri.toString() + '#' + uri.getFragment());
            return resolvedUri;
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.