org.openrdf.model.util
Class URIUtil

java.lang.Object
  extended by org.openrdf.model.util.URIUtil

public class URIUtil
extends Object

Author:
Arjohn Kampman

Constructor Summary
URIUtil()
           
 
Method Summary
static int getLocalNameIndex(String uri)
          Finds the index of the first local name character in an (non-relative) URI.
static boolean isCorrectURISplit(String namespace, String localName)
          Checks whether the URI consisting of the specified namespace and local name has been split correctly according to the URI splitting rules specified in URI.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URIUtil

public URIUtil()
Method Detail

getLocalNameIndex

public static int getLocalNameIndex(String uri)
Finds the index of the first local name character in an (non-relative) URI. This index is determined by the following the following steps: Note that the third step should never fail as every legal (non-relative) URI contains at least one ':' character to seperate the scheme from the rest of the URI. If this fails anyway, the method will throw an IllegalArgumentException.

Parameters:
uri - A URI string.
Returns:
The index of the first local name character in the URI string. Note that this index does not reference an actual character if the algorithm determines that there is not local name. In that case, the return index is equal to the length of the URI string.
Throws:
IllegalArgumentException - If the supplied URI string doesn't contain any of the separator characters. Every legal (non-relative) URI contains at least one ':' character to seperate the scheme from the rest of the URI.

isCorrectURISplit

public static boolean isCorrectURISplit(String namespace,
                                        String localName)
Checks whether the URI consisting of the specified namespace and local name has been split correctly according to the URI splitting rules specified in URI.

Parameters:
namespace - The URI's namespace, must not be null.
localName - The URI's local name, must not be null.
Returns:
true if the specified URI has been correctly split into a namespace and local name, false otherwise.
See Also:
URI, getLocalNameIndex(String)


Copyright © 2001-2009 Aduna. All Rights Reserved.