| java.lang.Object org.openrdf.model.util.URIUtil
URIUtil | public class URIUtil (Code) | | author: Arjohn Kampman |
Method Summary | |
public static int | getLocalNameIndex(String uri) Finds the index of the first local name character in an (non-relative)
URI. | 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. Parameters: localName - The URI's local name, must not be null. |
getLocalNameIndex | public static int getLocalNameIndex(String uri)(Code) | | Finds the index of the first local name character in an (non-relative)
URI. This index is determined by the following the following steps:
- Find the first occurrence of the '#' character,
- If this fails, find the last occurrence of the '/'
character,
- If this fails, find the last occurrence of the ':'
character.
- Add 1 to the found index and return this value.
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. The index of the first local name character in the URI string. Note thatthis index does not reference an actual character if the algorithm determinesthat there is not local name. In that case, the return index is equal to thelength of the URI string. throws: IllegalArgumentException - If the supplied URI string doesn't contain any of the separatorcharacters. 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)(Code) | | 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. Parameters: localName - The URI's local name, must not be null. true if the specified URI has been correctly split intoa namespace and local name, false otherwise. See Also: URI See Also: URIUtil.getLocalNameIndex(String) |
|
|