Here you can find the source of getParentURI(URI uri)
public static URI getParentURI(URI uri)
//package com.java2s; import java.net.*; public class Main { public static URI getParentURI(URI uri) { URI parent = null;//from w ww . ja v a2 s .co m if (uri != null) { String text = uri.toString(); int index = text.lastIndexOf('/'); if (index != -1) { text = text.substring(0, index); parent = URI.create(text); } } return parent; } }