Package aQute.libg.uri
Class URIUtil
java.lang.Object
aQute.libg.uri.URIUtil
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringstatic StringencodePath(String path) static intgetDefaultPort(String scheme) (package private) static booleanisAlphanum(int b) (package private) static booleanisPathAllowed(int b) static booleanAnswer 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(String uriString, URI uri) pathFromURI(URI uri) Attempts to fetch a path on the file system for the given URI.static URIResolves a URI reference against a base URI.
-
Field Details
-
WINDOWS_FILE_PATTERN
-
EMPTYURI
-
-
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.
-
pathFromURI
-
isRemote
Answer if the given URL is on the local system or remote -
getDefaultPort
-
encodePath
-
isPathAllowed
static boolean isPathAllowed(int b) -
isAlphanum
static boolean isAlphanum(int b) -
decode
-