code: 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 );
      }
docs: Get the directory path of the given URI.
  
  @param uri the URI from which to get the directory path.
  @return a String containing everything before the last slash of the given URI.