Java URL to File Name getFile(URL url)

Here you can find the source of getFile(URL url)

Description

For local file conversion.

License

Open Source License

Parameter

Parameter Description
url to convert

Return

file from url

Declaration

public static File getFile(URL url) 

Method Source Code


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

import java.net.URISyntaxException;
import java.net.URL;

public class Main {
    /**/*from  w w  w  .  j  a  v a 2 s  . c  om*/
     * For local file conversion. FIXME is this correct on Windows?
     * 
     * @param url
     *            to convert
     * @return file from url
     */
    public static File getFile(URL url) {
        File f = null;
        try {
            f = new File(url.toURI());
        } catch (URISyntaxException e) {
            f = new File(url.getPath());
        }
        return f;
    }
}

Related

  1. getFile(URL resourceUrl, String description)
  2. getFile(URL resourceUrl, String description)
  3. getFile(URL resourceUrl, String description)
  4. getFile(URL resourceUrl, String description)
  5. getFile(URL ressource)
  6. getFile(URL url)
  7. getFile(URL url)
  8. getFile(URL url)
  9. getFile(URL url)