java.lang.Object
org.jhotdraw8.base.net.UriUtil
UriUtil.
- Author:
- Werner Randelshofer
-
Method Summary
Modifier and TypeMethodDescriptionabsolutize(@Nullable URI base, @NonNull URI uri) Absolutizes an URI.static URIAdds a query.static URIAdds a query.static URIclearQuery(URI uri) static StringReturns the name of an URI for display in the title bar of a window.parseQuery(@NonNull URI uri) Parses the query of the URI.relativize(@Nullable URI base, @NonNull URI uri) static URISets the query on the specified URI.
-
Method Details
-
getName
Returns the name of an URI for display in the title bar of a window.If the URI is a file URI, then displays the file name followed by the path to the file. If the file is inside the user home directory, only the relative path is shown.
Examples:
uri = /User/me/Desktop/Hello.txt ⊢ title = Hello.txt [~/Desktop] uri = /User/notme/Desktop/Hello.txt ⊢ title = Hello.txt [/User/notme/Desktop] uri = /Volumes/NetworkDrive/Hello.txt ⊢ title = Hello.txt [/Volumes/NetworkDrive]- Parameters:
uri- the uri- Returns:
- the name
-
addQuery
Adds a query. If a query is already present, adds it after a '&' character. Both, the key, and the value may not include the characters '&' and '='.- Parameters:
uri- an urikey- the keyvalue- the value- Returns:
- the updated query
-
addQuery
Adds a query. If a query is already present, adds it after a '&' character. The query may not include the characters '&' or '='.- Parameters:
uri- an uriquery- the query- Returns:
- the updated query
-
setQuery
Sets the query on the specified URI. If a query is already present, it is removed.- Parameters:
uri- an uriquery- the query- Returns:
- the update uri
-
clearQuery
-
parseQuery
Parses the query of the URI. Assumes that the query consists of '&'-separated, key '=' value pairs.- Parameters:
uri- an URI- Returns:
- a map
-
relativize
-
absolutize
Absolutizes an URI.- Parameters:
base- the base URIuri- an URI that is relative to the base URI- Returns:
- the absolutized URI
-
getParent
-