public static String getDirName ( String uri ) { int lastSlash = uri . lastIndexOf ( ' ' ) ; assert lastSlash != - 1 : uri ; assert uri . length ( ) > 1 : uri ; assert lastSlash < uri . length ( ) - 1 : "URI must not end with a slash: " + uri ; return uri . substring ( 0 , lastSlash ) ; }
Get the directory path of the given URI .