Here you can find the source of getPath(String url)
public static String getPath(String url)
//package com.java2s; //License from project: Open Source License import java.net.MalformedURLException; import java.net.URL; public class Main { public static String getPath(String url) { try {//from w ww.j a v a 2 s .co m URL tempUrl = new URL(url); return tempUrl.getPath(); } catch (MalformedURLException e) { throw new IllegalArgumentException("The url " + url + " is not valid."); } } }