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 was deprecated in API level 3. 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 ()

Added in API level 1

Public Methods

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

Added in API level 1

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

Added in API level 1

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

Added in 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)

Added in API level 1

Cleans up (if possible) user-entered web addresses

public static boolean isAboutUrl (String url)

Added in API level 1

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

public static boolean isAssetUrl (String url)

Added in API level 1

Returns
  • True iff the url is an asset file.

public static boolean isContentUrl (String url)

Added in API level 1

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

public static boolean isCookielessProxyUrl (String url)

Added in API level 1

This method was deprecated in API level 3.
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)

Added in API level 1

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

public static boolean isFileUrl (String url)

Added in API level 1

Returns
  • True iff the url is a local file.

public static boolean isHttpUrl (String url)

Added in API level 1

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

public static boolean isHttpsUrl (String url)

Added in API level 1

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

public static boolean isJavaScriptUrl (String url)

Added in API level 1

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

public static boolean isNetworkUrl (String url)

Added in API level 1

Returns
  • True iff the url is a network url.

public static boolean isValidUrl (String url)

Added in API level 1

Returns
  • True iff the url is valid.

public static String stripAnchor (String url)

Added in API level 1

Strips the url of the anchor.