Here you can find the source of getFileName(URL url)
Parameter | Description |
---|---|
url | to parse |
public static String getFileName(URL url)
//package com.java2s; import java.net.URL; public class Main { /**/*from w w w . j a v a 2s . c o m*/ * returns the last element of the URL's path * * @param url to parse * @return the last element of the URL's path */ public static String getFileName(URL url) { String[] pathElements = url.getPath().split("/"); return pathElements[pathElements.length - 1]; } }