code: @Nullable
    public String getLeadingPath(int n) {
      String path = mUri.getPath();
      if (n == 0 && path.indexOf(AlluxioURI.SEPARATOR) == 0) { // the special case
        return AlluxioURI.SEPARATOR;
      }
      int depth = getDepth();
      if (depth < n) {
        return null;
      } else if (depth == n) {
        return path;
      } else {
        String[] comp = path.split(SEPARATOR);
        return StringUtils.join(Arrays.asList(comp).subList(0, n + 1), SEPARATOR);
      }
    }
docs: Gets the first n components of the {@link AlluxioURI} path. There is no trailing separator as
  the path will be normalized by normalizePath().
  
  <pre>
  /a/b/c, 0              = /
  /a/b/c, 1              = /a
  /a/b/c, 2              = /a/b
  /a/b/c, 3              = /a/b/c
  /a/b/c, 4              = null
  </pre>
  
  @param n identifies the number of path components to get
  @return the first n path components, null if the path has less than n components