Java Path to URL getURLs(String thePaths[])

Here you can find the source of getURLs(String thePaths[])

Description

Returns the URLs for given paths.

License

Open Source License

Declaration

public static URL[] getURLs(String thePaths[]) 

Method Source Code


//package com.java2s;
import java.io.File;
import java.net.URL;

public class Main {
    /**//from w  w  w.  j a v  a 2 s .c  o  m
     * Returns the URLs for given paths.
     */
    public static URL[] getURLs(String thePaths[]) {
        URL urls[] = new URL[thePaths.length];
        for (int i = 0; i < thePaths.length; i++)
            urls[i] = getURL(thePaths[i]);
        return urls;
    }

    /**
     * Returns a URL for given path.
     */
    public static URL getURL(String aPath) {
        try {
            return getFile(aPath).toURI().toURL();
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    /**
     * Returns a File for given path.
     */
    public static File getFile(String aPath) {
        return new File(aPath);
    }
}

Related

  1. getUrlPath(URL url)
  2. getUrlPath(URL url)
  3. getURLPathFromURI(String uri)
  4. getURLPathFromURN(String urn)
  5. getURLs(List paths)
  6. getUrlsFromClassPath(String path)
  7. getWebDocInfoStr(String urlPath)
  8. getWorkspaceURL(String subpath)
  9. pathAsUrlString(String path)