to top
Android APIs
public final class

URLUtil

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

Summary

Public Constructors

? Examples
URLUtil()
Public Methods

? Examples
static String composeSearchUrl( String inQuery, String template, String queryPlaceHolder)

? Examples
static byte[] decode(byte[] url)

? Examples
final static String guessFileName( String url, String contentDisposition, String mimeType)
Guesses canonical filename that a download would have, using the URL and contentDisposition.

? Examples
static String guessUrl( String inUrl)
Cleans up (if possible) user-entered web addresses

? Examples
static boolean isAboutUrl( String url)

? Examples
static boolean isAssetUrl( String url)

? Examples
static boolean isContentUrl( String url)

? Examples
static boolean isCookielessProxyUrl( String url)
This method was deprecated in API level 3. Cookieless proxy is no longer supported.

? Examples
static boolean isDataUrl( String url)

? Examples
static boolean isFileUrl( String url)

? Examples
static boolean isHttpUrl( String url)

? Examples
static boolean isHttpsUrl( String url)

? Examples
static boolean isJavaScriptUrl( String url)

? Examples
static boolean isNetworkUrl( String url)

? Examples
static boolean isValidUrl( String url)

? Examples
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.

No examples for this method.
Frequently called with: [Clear]
Portions of this page are reproduced from work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License. The original page is available here.