List of utility methods to do URL to File Name Convert
String | getFileName(URL url) returns the last element of the URL's path String[] pathElements = url.getPath().split("/"); return pathElements[pathElements.length - 1]; |
File | toFile(URL url) to File if (url == null || !"file".equalsIgnoreCase(url.getProtocol())) { return null; } else { String filename = url.getFile() .replace('/', File.separatorChar); filename = decodeUrl(filename); return new File(filename); |