Package java.io

Examples of java.io.File.toURI()


        throw new RegainException("Jar file does not exist: "
                + jarFile.getAbsolutePath());
      }

      try {
        classLoader = new URLClassLoader(new URL[]{jarFile.toURI().toURL()}, superClass.getClassLoader());
      } catch (MalformedURLException exc) {
        throw new RegainException("Creating class loader for "
                + "jar file failed: " + jarFile.getAbsolutePath(),
                exc);
      }
View Full Code Here


            final File file = new File(directory, resourceName);
            if (file.exists())
            {
                try
                {
                    return file.toURI().toURL();
                }
                catch (final MalformedURLException exception)
                {
                    // - ignore, we just try to find the resource on the classpath
                }
View Full Code Here

                    url = ResourceUtils.resolveClasspathResource(path);
                }
                else
                {
                    final File file = new File(path);
                    url = file.exists() ? file.toURI().toURL() : new URL(path);
                }
            }
            catch (MalformedURLException exception)
            {
                // ignore means no protocol was specified
View Full Code Here

  public void testValidXml() {
    try {
      File webXml = new File("src/main/webapp/WEB-INF/web.xml");

      DocumentUtil.getDocument(webXml.toURI().toURL(), SchemaFactory.newInstance(
          XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema());
    }
    catch (Exception e) {
      e.printStackTrace();
      fail(e.getMessage());
View Full Code Here

                                {
                                    throw new AndroMDAppException("An error occured while processing template --> '" +
                                        path + "' with template context '" + this.templateContext + "'", throwable);
                                }
                                writer.flush();
                                this.printText(MARGIN + "Output: '" + outputFile.toURI().toURL() + "'");
                                ResourceWriter.instance().writeStringToFile(
                                    writer.toString(),
                                    outputFile);
                            }
                            processedResources.add(outputFile);
View Full Code Here

                                if (write)
                                {
                                    ResourceWriter.instance().writeUrlToFile(
                                        resource,
                                        outputFile.toString());
                                    this.printText(MARGIN + "Output: '" + outputFile.toURI().toURL() + "'");
                                }
                                processedResources.add(outputFile);
                            }
                        }
                    }
View Full Code Here

            final String directoryPath = ((String)directoryIterator.next()).trim();
            final File directory = new File(rootDirectory, directoryPath);
            if (this.isWriteable(directoryPath))
            {
                directory.mkdirs();
                this.printText(MARGIN + "Output: '" + directory.toURI().toURL() + "'");
            }
        }

        if (write)
        {
View Full Code Here

                {
                    throw new AndroMDAppException("No instructions are available at --> '" + instructions +
                        "', please make sure you have the correct instructions defined in your descriptor --> '" +
                        this.resource + "'");
                }
                this.printText(MARGIN + "Instructions for your new application --> '" + instructions.toURI().toURL() + "'");
            }
            this.printLine();
        }
        return processedResources;
    }
View Full Code Here

                final File file = new File((String)classpathFiles.get(ctr));
                if (this.getLog().isDebugEnabled())
                {
                    getLog().debug("adding to classpath '" + file + "'");
                }
                classpathUrls.add(file.toURI().toURL());
            }
        }
        final URLClassLoader loader =
            new URLClassLoader((URL[])classpathUrls.toArray(new URL[0]),
                Thread.currentThread().getContextClassLoader());
View Full Code Here

                    Message msg = new Message("FILE_OPEN_ERROR_EXC", LOG, location);
                    throw new ConfigurationException(msg);
                }
                File file = new File(path);
                if (file.exists()) {
                    return new InputSource(file.toURI().toString());
                }
            } else {
                //TODO - other protocols like HTTP?               
            }
        }
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.