java.lang.Object
com.aoapps.net.URIParser
URI parsing utilities.
- Author:
- AO Industries, Inc.
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
getPathEnd
(String uri) Find the first of '?'static int
getPathEnd
(String uri, int fromIndex) Find the first of '?'static final String
Gets the scheme for a URI, ornull
when no scheme found.static int
Gets the length of a scheme.static boolean
Checks if a URI has a scheme, not including any empty scheme (starts with ':').static boolean
Checks if a URI starts with the given scheme.
-
Method Details
-
getSchemeLength
Gets the length of a scheme.- Returns:
- The index of the ':' or
-1
on empty scheme, invalid character in scheme, or no colon found.
-
isScheme
Checks if a URI starts with the given scheme.- Parameters:
scheme
- The scheme to look for, not including colon. For example"http"
.- Throws:
IllegalArgumentException
- whenscheme
is determined to be invalid. Please note that this determination is not guaranteed as shortcuts may skip individual character comparisons.
-
hasScheme
Checks if a URI has a scheme, not including any empty scheme (starts with ':'). -
getScheme
Gets the scheme for a URI, ornull
when no scheme found. The scheme must start the URI, and matchALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
before the first colon (:) found. The scheme is normalized to lower-case. An empty scheme will never be returned (if the URI starts with ':').- Returns:
- The scheme, not including colon, or
null
when not found. For example"http"
.
-
getPathEnd
Find the first of '?' or '#' from the given starting index.- Returns:
- The index of the first '?' or '#' or
uri.length()
when not found.
-
getPathEnd
Find the first of '?' or '#'.- Returns:
- The index of the first '?' or '#' or
uri.length()
when not found.
-