Java URI to Parent URI getParentURI(URI uri)

Here you can find the source of getParentURI(URI uri)

Description

get Parent URI

License

Open Source License

Declaration

public static URI getParentURI(URI uri) 

Method Source Code


//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;
    }
}

Related

  1. getParent(URI uri)
  2. getParentName(URI uri)
  3. getParents(final URI uri)
  4. getParentURI(URI uri)
  5. getParentURI(URI uri)
  6. getParentUriPath(String uriPath)