Package aQute.libg.uri
Class URIUtil
java.lang.Object
aQute.libg.uri.URIUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
static String
encodePath
(String path) static int
getDefaultPort
(String scheme) static boolean
Answer if the given URL is on the local system or remotepathFromURI
(String uriString) Attempts to fetch a path on the file system for the given URI string.pathFromURI
(URI uri) Attempts to fetch a path on the file system for the given URI.static URI
Resolves a URI reference against a base URI.
-
Constructor Details
-
URIUtil
public URIUtil()
-
-
Method Details
-
resolve
Resolves a URI reference against a base URI. Work-around for bugs in java.net.URI (e.g.http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4708535)- Parameters:
baseURI
-reference
-- Returns:
- the resolved
URI
- Throws:
URISyntaxException
-
pathFromURI
Attempts to fetch a path on the file system for the given URI string. Tries a few more tricks than the standard method of Paths.get(new URI(uriString)) - it can handle plain paths, and also nested URI pseudo-schemes like reference: and jar:. Examples:- /path/to/file => /path/to/file
- reference:file:/path/to/file => /path/to/file
- jar:file:/path/to/file.jar!/some/contained/element => /path/to/file.jar
- http://server/path/to/file => null
- Parameters:
uriString
- The URI string for which we are attempting to construct a path.- Returns:
- The method's best guess as to which file on the local filesystem this URI refers, or an empty Optional if it's invalid or not a local filesystem URI.
-
pathFromURI
Attempts to fetch a path on the file system for the given URI. Tries a few more tricks than the standard method of Paths.get(uri) - it can handle plain paths, and also nested URI pseudo-schemes like reference: and jar:. Examples:- /path/to/file => /path/to/file
- reference:file:/path/to/file => /path/to/file
- jar:file:/path/to/file.jar!/some/contained/element => /path/to/file.jar
- http://server/path/to/file => null
- Parameters:
uri
- The URI for which we are attempting to construct a path.- Returns:
- The method's best guess as to which file on the local filesystem this URI refers, or an empty Optional if it's invalid or not a local filesystem URI.
-
isRemote
Answer if the given URL is on the local system or remote -
getDefaultPort
-
encodePath
-
decode
-