Package java.net

Examples of java.net.URL.toURI()


            URL url = Thread.currentThread().getContextClassLoader().getResource(name);
            if (url == null) {
                throw new IllegalArgumentException("No resource called " + name);
            }
            try {
                File file = new File(url.toURI());
                return file.getParentFile();
            } catch (URISyntaxException e) {
                throw new RuntimeException("Could not get file for " + url);
            }
        }
View Full Code Here


            URL url = Thread.currentThread().getContextClassLoader().getResource(name);
            if (url == null) {
                throw new IllegalArgumentException("No resource called " + name);
            }
            try {
                File file = new File(url.toURI());
                return file.getParentFile();
            } catch (URISyntaxException e) {
                throw new RuntimeException("Could not get file for " + url);
            }
        }
View Full Code Here

           URL url = Thread.currentThread().getContextClassLoader().getResource(name);
           if (url == null) {
              return null;
           }
           try {
               return new File(url.toURI());
           } catch (URISyntaxException e) {
               throw new RuntimeException("Could not get file for " + url);
           }
       }
View Full Code Here

    }

    @Nonnull
    private File findResource(String resource) throws URISyntaxException {
        URL resUrl = Resources.getResource(resource);
        return new File(resUrl.toURI());
    }

    @Nonnull
    private String readResource(String resource) throws URISyntaxException, IOException {
        URL url = Resources.getResource(resource);
View Full Code Here

    public Image getImage(Object element) {
        OSGiFramework fwk = (OSGiFramework) element;
        URL fwkIcon = fwk.getIcon();
        URI fwkIconURI = null;
        try {
            fwkIconURI = fwkIcon.toURI();
        } catch (URISyntaxException e1) {}

        Image image = null;

        if (fwkIconURI != null) {
View Full Code Here

            }

            if (url != null) {
                if ("file".equals(url.getProtocol())) {
                    try {
                        bundleFs.add(new PlainFile(new Path(new File(url.toURI()))));
                    }
                    catch (URISyntaxException e) {
                        throw (IllegalArgumentException) new IllegalArgumentException(
                                "Can't determine url of bundle " + k).initCause(e);
                    }
View Full Code Here

      try {
        URL url = this.getClass().getResource( mappingFile );
        if ( url == null ) {
          continue;
        }
        File file = new File( url.toURI() );
        context.logMessage( Diagnostic.Kind.OTHER, "Check file  " + mappingFile );
        if ( file.exists() ) {
          fileStampCheck.add( mappingFile, file.lastModified() );
        }
      }
View Full Code Here

  public boolean isDirectory(URI uri) {
    try {
      URL res = clazz.getResource(getPath(uri));
      if(res == null)
        return false;
      return registry.isDirectory(res.toURI());
    } catch (URISyntaxException e) {
      return false;
    }
  }
View Full Code Here

  public boolean isFile(URI uri) {
    try {
      URL res = clazz.getResource(getPath(uri));
      if(res == null)
        return false;
      return registry.isFile(res.toURI());
    } catch (URISyntaxException e) {
      return false;
    }
  }
View Full Code Here

  public long lastModified(URI uri) throws IOException {
    try {
      URL res = clazz.getResource(getPath(uri));
      if(res == null)
        throw new FileNotFoundException(getPath(uri));
      return registry.lastModified(res.toURI());
    } catch (URISyntaxException e) {
      throw new IOException(e.getMessage(), 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.