Java Utililty Methods URI to Base

List of utility methods to do URI to Base

Description

The list of methods to do URI to Base are organized into topic(s).

Method

StringgetBase(final URI uri)
Get the base name of a URI (e.g.
if (uri != null) {
    String tempName = new String("");
    final StringTokenizer stk1 = new StringTokenizer(uri.toString(), "/\\");
    while (stk1.hasMoreTokens()) {
        tempName = stk1.nextToken();
    final StringTokenizer stk = new StringTokenizer(tempName, ".");
    return stk.nextToken();
...
StringgetBaseName(URI uri)
Returns the base name for a component URI, e.g.
String s = uri.toString();
int pos = s.lastIndexOf('/');
if (pos > -1) {
    return s.substring(pos + 1);
} else {
    return s;
URIgetBaseURI()
Get the Basedir for the project as a URI
if (baseURI == null) {
    getBasedir();
return baseURI;
URIgetBaseURI()
get Base URI
if (baseURI == null) {
    getBasedir();
return baseURI;
URIgetBaseURI(final URI uri)
Gets the base part (schema, host, port and path) of the specified URI.
if (uri == null)
    return null;
try {
    return new URI(uri.getScheme(), null, uri.getHost(), uri.getPort(), uri.getPath(), null, null);
} catch (URISyntaxException e) {
    return null;