Package java.net

Examples of java.net.URL.toURI()


          final URI              uri;

          domain = TimeTest.class.getProtectionDomain();
          source = domain.getCodeSource();
          url    = source.getLocation();
          uri    = url.toURI();

          return (uri);
      }

      private static URI getFile(final URI    where,
View Full Code Here


        String propFileName = getBaseClassName(component.getClass()) + ".beanprops";
        URL propFileURL = component.getClass().getResource(propFileName);
        long timestamp = 0;
        if (propFileURL != null && propFileURL.getProtocol().equals("file")) {
            try {
                timestamp = new File(propFileURL.toURI()).lastModified();
            }
            catch (URISyntaxException e) { /* Ignore - treat as zero */
            }
            }

View Full Code Here

    private static String getFile(String resource) {
        URL url = Utils.class.getClassLoader().getResource(resource);
        File f;
        try {
            f = new File(url.toURI());
        } catch(URISyntaxException e) {
            f = new File(url.getPath());
        }
        return f.toString();
    }
View Full Code Here

    private static String getFile(String resource) {
        URL url = Utils.class.getClassLoader().getResource(resource);
        File f;
        try {
            f = new File(url.toURI());
        } catch(URISyntaxException e) {
            f = new File(url.getPath());
        }
        return f.toString();
    }
View Full Code Here

    private static String getFile(String resource) {
        URL url = Utils.class.getClassLoader().getResource(resource);
        File f;
        try {
            f = new File(url.toURI());
        } catch(URISyntaxException e) {
            f = new File(url.getPath());
        }
        return f.toString();
    }
View Full Code Here

        try {
            File f = null;
            try {
                // Use the URI.getPath() to decode any escaped characters ie %20
                URI uri = modelURL.toURI();
                String path = uri.getPath();
                f = new File(path);
            } catch (URISyntaxException ex) {
                Logger.getLogger(KmzLoader.class.getName()).log(Level.SEVERE, "Error processing url "+modelURL.toExternalForm(), ex);
                return null;
View Full Code Here

                }
            });
            return;
        }
        try {
            ZipFile zipFile = new ZipFile(new File(modelURL.toURI()));
            deployZipModels(zipFile, targetDir);
            String kmzFilename = modelURL.toURI().getPath();
            kmzFilename = kmzFilename.substring(kmzFilename.lastIndexOf('/')+1);
            deployedModel.setModelURL(importedModel.getDeploymentBaseURL()+kmzFilename+"/"+((KmzImportedModel)importedModel).getPrimaryModel()+".gz");
            deployedModel.setLoaderDataURL(importedModel.getDeploymentBaseURL()+kmzFilename+"/"+kmzFilename+".ldr");
View Full Code Here

            return;
        }
        try {
            ZipFile zipFile = new ZipFile(new File(modelURL.toURI()));
            deployZipModels(zipFile, targetDir);
            String kmzFilename = modelURL.toURI().getPath();
            kmzFilename = kmzFilename.substring(kmzFilename.lastIndexOf('/')+1);
            deployedModel.setModelURL(importedModel.getDeploymentBaseURL()+kmzFilename+"/"+((KmzImportedModel)importedModel).getPrimaryModel()+".gz");
            deployedModel.setLoaderDataURL(importedModel.getDeploymentBaseURL()+kmzFilename+"/"+kmzFilename+".ldr");
            deployDeploymentData(targetDir, deployedModel, kmzFilename);
            importedModel.setDeployedModelURL(importedModel.getDeploymentBaseURL()+kmzFilename+"/"+kmzFilename+".dep");
View Full Code Here

                }
            });
            return;
        }
        try {
            ZipFile zipFile = new ZipFile(new File(modelURL.toURI()));
            deployZipTextures(zipFile, targetDir, modelPath, deploymentMapping);
        } catch (ZipException ex) {
            Logger.getLogger(KmzLoader.class.getName()).log(Level.SEVERE, null, ex);
        } catch (IOException ex) {
            Logger.getLogger(KmzLoader.class.getName()).log(Level.SEVERE, null, ex);
View Full Code Here

                // first try URL.getFile() which works for opaque URLs (file:foo) and paths without spaces
                configFileName = configLocation.getFile();
                File configFile = new File(configFileName);
                // then try alternative approach which works for all hierarchical URLs with or without spaces
                if (!configFile.exists())
                    configFileName = new File(configLocation.toURI()).getCanonicalPath();
            }
            catch (Exception e)
            {
                throw new RuntimeException("Couldn't convert log4j configuration location to a valid file", 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.