Google is committed to advancing racial equity for Black communities. See how.
Added in API level 1

URLUtil

class URLUtil
kotlin.Any
   ↳ android.webkit.URLUtil

Summary

Public constructors

Public methods

static String!
composeSearchUrl(inQuery: String!, template: String!, queryPlaceHolder: String!)

static ByteArray!

static String!
guessFileName(url: String!, contentDisposition: String?, mimeType: String?)

Guesses canonical filename that a download would have, using the URL and contentDisposition.

static String!
guessUrl(inUrl: String!)

Cleans up (if possible) user-entered web addresses

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static Boolean

static String!

Strips the url of the anchor.

Public constructors

<init>

URLUtil()

Public methods

composeSearchUrl

Added in API level 1
static fun composeSearchUrl(
    inQuery: String!,
    template: String!,
    queryPlaceHolder: String!
): String!

decode

Added in API level 1
static fun decode(url: ByteArray!): ByteArray!

guessFileName

Added in API level 1
static fun guessFileName(
    url: String!,
    contentDisposition: String?,
    mimeType: String?
): String!

Guesses canonical filename that a download would have, using the URL and contentDisposition. File extension, if not defined, is added based on the mimetype

Parameters
url String!: Url to the content
contentDisposition String?: Content-Disposition HTTP header or null This value may be null.
mimeType String?: Mime-type of the content or null This value may be null.
Return
String! suggested filename

guessUrl

Added in API level 1
static fun guessUrl(inUrl: String!): String!

Cleans up (if possible) user-entered web addresses

isAboutUrl

Added in API level 1
static fun isAboutUrl(url: String!): Boolean
Return
Boolean true if the url is an about: url.

isAssetUrl

Added in API level 1
static fun isAssetUrl(url: String!): Boolean
Return
Boolean true if the url is an asset file.

isContentUrl

Added in API level 1
static fun isContentUrl(url: String!): Boolean
Return
Boolean true if the url is a content: url.

isCookielessProxyUrl

Added in API level 1
Deprecated in API level 15
static fun isCookielessProxyUrl(url: String!): Boolean

Deprecated: Cookieless proxy is no longer supported.

Return
Boolean true if the url is a proxy url to allow cookieless network requests from a file url.

isDataUrl

Added in API level 1
static fun isDataUrl(url: String!): Boolean
Return
Boolean true if the url is a data: url.

isFileUrl

Added in API level 1
static fun isFileUrl(url: String!): Boolean
Return
Boolean true if the url is a local file.

isHttpUrl

Added in API level 1
static fun isHttpUrl(url: String!): Boolean
Return
Boolean true if the url is an http: url.

isHttpsUrl

Added in API level 1
static fun isHttpsUrl(url: String!): Boolean
Return
Boolean true if the url is an https: url.

isJavaScriptUrl

Added in API level 1
static fun isJavaScriptUrl(url: String!): Boolean
Return
Boolean true if the url is a javascript: url.

isNetworkUrl

Added in API level 1
static fun isNetworkUrl(url: String!): Boolean
Return
Boolean true if the url is a network url.

isValidUrl

Added in API level 1
static fun isValidUrl(url: String!): Boolean
Return
Boolean true if the url is valid.

stripAnchor

Added in API level 1
static fun stripAnchor(url: String!): String!

Strips the url of the anchor.