@UnstableApi
class UriUtil


Utility methods for manipulating URIs.

Summary

Public functions

java-static String!
@UnstableApi
getRelativePath(baseUri: Uri!, targetUri: Uri!)

Calculates the relative path from a base URI to a target URI.

java-static Boolean

Returns true if the URI is starting with a scheme component, false otherwise.

java-static Uri!
removeQueryParameter(uri: Uri!, queryParameterName: String!)

Removes query parameter from a URI, if present.

java-static String!
resolve(baseUri: String?, referenceUri: String?)

Performs relative resolution of a referenceUri with respect to a baseUri.

java-static Uri!
resolveToUri(baseUri: String?, referenceUri: String?)

Like resolve, but returns a Uri instead of a String.

Public functions

getRelativePath

@UnstableApi
java-static fun getRelativePath(baseUri: Uri!, targetUri: Uri!): String!

Calculates the relative path from a base URI to a target URI.

Returns
String!

The relative path from the base URI to the target URI, or targetUri if the URIs have different schemes or authorities.

isAbsolute

java-static fun isAbsolute(uri: String?): Boolean

Returns true if the URI is starting with a scheme component, false otherwise.

removeQueryParameter

java-static fun removeQueryParameter(uri: Uri!, queryParameterName: String!): Uri!

Removes query parameter from a URI, if present.

Parameters
uri: Uri!

The URI.

queryParameterName: String!

The name of the query parameter.

Returns
Uri!

The URI without the query parameter.

resolve

java-static fun resolve(baseUri: String?, referenceUri: String?): String!

Performs relative resolution of a referenceUri with respect to a baseUri.

The resolution is performed as specified by RFC-3986.

Parameters
baseUri: String?

The base URI.

referenceUri: String?

The reference URI to resolve.

resolveToUri

java-static fun resolveToUri(baseUri: String?, referenceUri: String?): Uri!

Like resolve, but returns a Uri instead of a String.

Parameters
baseUri: String?

The base URI.

referenceUri: String?

The reference URI to resolve.