Package java.io

Examples of java.io.File.toURL()


        assert (spec != null);
        final boolean isFile = spec.startsWith("file:");
        try {
            if (isFile) {
                final File file = new File(spec.substring(5));
                return adjustTrailingSlash(file.toURL(), file.isDirectory());
            }
            return new URL(spec);
        } catch (MalformedURLException e) {
            throw new IllegalArgumentException("Could't build URL: " + spec);
        }
View Full Code Here


              try{

                if ( f.exists()){

                  URL  file_url = f.toURL();

                  audio_clip = Applet.newAudioClip( file_url );
                }

              }catch( Throwable  e ){
View Full Code Here

        String sJar = u.toString();
        sJar = sJar.substring(0, sJar.length() - prefix.length() - extension.length());
        URL jarURL = new URL(sJar);

        // User dir overrides app dir which overrides jar file bundles
        URL[] urls = {userBundleFile.toURL(), appBundleFile.toURL(), jarURL};
       
        /* This is debugging code, use it when things go wrong :) The line number
         * is approximate as the input stream is buffered by the reader...
        
        {
View Full Code Here

         * system property allows us to know where the lib directory is independently
         * of the user dir*/
         f = new File(LIB_DIR_SP);
      }

      URL context = f.toURL();
      URL jar = new URL(context, INSTANCE_LIBRARY);
      URLClassLoader ucl1 = new URLClassLoader(new URL[]{jar}, null);

      return ucl1;
   }
View Full Code Here

                                                        File.pathSeparator);
        while (tokenizer.hasMoreTokens()) {
            String path = tokenizer.nextToken();
            try {
                File libFile = new File(path);
                urls.add(libFile.toURL());
            } catch (IOException ioe) {
                // Failing a toCanonicalPath on a file that
                // exists() should be a JVM regression test,
                // therefore we have permission to freak uot
                throw new RuntimeException(ioe.toString());
View Full Code Here

                                                        File.pathSeparator);
        while (tokenizer.hasMoreTokens()) {
            String path = tokenizer.nextToken();
            try {
                File libFile = new File(path);
                urls.add(libFile.toURL());
            } catch (IOException ioe) {
                // Failing a toCanonicalPath on a file that
                // exists() should be a JVM regression test,
                // therefore we have permission to freak uot
                throw new RuntimeException(ioe.toString());
View Full Code Here

    this.baseDir = baseDir;
    File[] subDirs = listComponentDirs();// baseDir.listFiles();
    for (File componentDir : subDirs) {
      File metaFile = new File(componentDir, "meta-inf");
      try {
        URL metaFileUrl = metaFile.toURL();
        if (log.isDebugEnabled()) {
          log.debug("reading: " + metaFileUrl.toString());
        }
        InputStream modelFileInputStream = metaFileUrl.openStream();
        try {
View Full Code Here

  protected void execute(Store store, UpdateAssertCommandArguments arguments) {
    File uploadFile = arguments.getUploadFile();
    Model model = ModelFactory.createDefaultModel();
    String fileURLString;
    try {
      fileURLString = uploadFile.toURL().toString();
    } catch (MalformedURLException e1) {
      throw new RuntimeException(e1);
    }
    String lang = "RDF/XML";
    if (fileURLString.endsWith(".nt")) {
View Full Code Here

          "graph");
      Graph graph = cache.get(modelFile);
      if (graph == null) {
        Model model = ModelFactory.createDefaultModel();
        try {
          URL modelFileUrl = modelFile.toURL();
          if (log.isDebugEnabled()) {
            log.debug("reading: " + modelFileUrl.toString());
          }
          InputStream modelFileInputStream = modelFileUrl
              .openStream();
View Full Code Here

      } catch (ParseException e) {
        throw new RuntimeException(e);
      }
      Model model = ModelFactory.createDefaultModel();
      try {
        model.read(file.toURL().toString());
      } catch (MalformedURLException e) {
        throw new RuntimeException(e);
      }
      FCAGraph graph = new FCAGraphImpl(model);
      assertions.add(new Assertion(new SourceImpl(sourceString), graph,
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.