Package libcore.net.url
Class UrlUtils
java.lang.Object
libcore.net.url.UrlUtils
public final class UrlUtils extends Object
-
Method Summary
Modifier and Type Method Description static StringauthoritySafePath(String authority, String path)Returns a path that can be safely concatenated withauthority.static StringcanonicalizePath(String path, boolean discardRelativePrefix)Returns the path will relative path segments like ".." and "." resolved.static intfindFirstOf(String string, String chars, int start, int end)Returns the index of the first char ofcharsinstringbounded betweenstartandend.static StringgetSchemePrefix(String spec)Returns the scheme prefix like "http" from the URL spec, or null if the spec doesn't start with a scheme.static booleanisValidSchemeChar(int index, char c)
-
Method Details
-
canonicalizePath
Returns the path will relative path segments like ".." and "." resolved. The returned path will not necessarily start with a "/" character. This handles ".." and "." segments at both the beginning and end of the path.- Parameters:
discardRelativePrefix- true to remove leading ".." segments from the path. This is appropriate for paths that are known to be absolute.
-
authoritySafePath
Returns a path that can be safely concatenated withauthority. If the authority is null or empty, this can be any path. Otherwise the paths run together likehttp://android.comindex.html. -
getSchemePrefix
Returns the scheme prefix like "http" from the URL spec, or null if the spec doesn't start with a scheme. Scheme prefixes match this pattern:alpha ( alpha | digit | '+' | '-' | '.' )* ':' -
isValidSchemeChar
public static boolean isValidSchemeChar(int index, char c) -
findFirstOf
Returns the index of the first char ofcharsinstringbounded betweenstartandend. This returnsendif none of the characters exist in the requested range.
-