to top
Android APIs
public final class

URLUtil

extends Object
java.lang.Object
   ↳ android.webkit.URLUtil

Summary

Public Constructors
URLUtil()
Public Methods
static String composeSearchUrl(String inQuery, String template, String queryPlaceHolder)
static byte[] decode(byte[] url)
final static String guessFileName(String url, String contentDisposition, String mimeType)
Guesses canonical filename that a download would have, using the URL and contentDisposition.
static String guessUrl(String inUrl)
Cleans up (if possible) user-entered web addresses
static boolean isAboutUrl(String url)
static boolean isAssetUrl(String url)
static boolean isContentUrl(String url)
static boolean isCookielessProxyUrl(String url)
This method is deprecated. Cookieless proxy is no longer supported.
static boolean isDataUrl(String url)
static boolean isFileUrl(String url)
static boolean isHttpUrl(String url)
static boolean isHttpsUrl(String url)
static boolean isJavaScriptUrl(String url)
static boolean isNetworkUrl(String url)
static boolean isValidUrl(String url)
static String stripAnchor(String url)
Strips the url of the anchor.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public URLUtil ()

Since: API Level 1

Public Methods

public static String composeSearchUrl (String inQuery, String template, String queryPlaceHolder)

Since: API Level 1

public static byte[] decode (byte[] url)

Since: API Level 1

public static final String guessFileName (String url, String contentDisposition, String mimeType)

Since: API Level 1

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 Url to the content
contentDisposition Content-Disposition HTTP header or null
mimeType Mime-type of the content or null
Returns
  • suggested filename

public static String guessUrl (String inUrl)

Since: API Level 1

Cleans up (if possible) user-entered web addresses

public static boolean isAboutUrl (String url)

Since: API Level 1

Returns
  • True iff the url is an about: url.

public static boolean isAssetUrl (String url)

Since: API Level 1

Returns
  • True iff the url is an asset file.

public static boolean isContentUrl (String url)

Since: API Level 1

Returns
  • True iff the url is a content: url.

public static boolean isCookielessProxyUrl (String url)

Since: API Level 1

This method is deprecated.
Cookieless proxy is no longer supported.

Returns
  • True iff the url is a proxy url to allow cookieless network requests from a file url.

public static boolean isDataUrl (String url)

Since: API Level 1

Returns
  • True iff the url is a data: url.

public static boolean isFileUrl (String url)

Since: API Level 1

Returns
  • True iff the url is a local file.

public static boolean isHttpUrl (String url)

Since: API Level 1

Returns
  • True iff the url is an http: url.

public static boolean isHttpsUrl (String url)

Since: API Level 1

Returns
  • True iff the url is an https: url.

public static boolean isJavaScriptUrl (String url)

Since: API Level 1

Returns
  • True iff the url is a javascript: url.

public static boolean isNetworkUrl (String url)

Since: API Level 1

Returns
  • True iff the url is a network url.

public static boolean isValidUrl (String url)

Since: API Level 1

Returns
  • True iff the url is valid.

public static String stripAnchor (String url)

Since: API Level 1

Strips the url of the anchor.