Android Utililty Methods URL to File Name Convert

List of utility methods to do URL to File Name Convert

Description

The list of methods to do URL to File Name Convert are organized into topic(s).

Method

StringgetFileName(URL url)
returns the last element of the URL's path
String[] pathElements = url.getPath().split("/");
return pathElements[pathElements.length - 1];
FiletoFile(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);