public class UrlUtil extends Object
Constructor and Description |
---|
UrlUtil() |
Modifier and Type | Method and Description |
---|---|
static String |
encode(String data)
Encode.
|
static String |
generateUA()
generates a valid user-agent
something like: Mozilla/5.0 (Windows; Windows NT 6.1; Windows 7 6.1; U; amd64; de-DE; rv:26.0) Gecko/20100101 Firefox/26.0 but with correct OS and language values |
static String |
generateUA(String language)
generates a valid user-agent
something like: Mozilla/5.0 (Windows; Windows NT 6.1; Windows 7 6.1; U; amd64; de-DE; rv:26.0) Gecko/20100101 Firefox/26.0 but with correct OS and language values |
static String |
getBasename(String url)
gets the BaseName (w/o extension) of an URL (better than commons-io)
|
static String |
getBaseUrl(String url)
Returns the the entire Url Path except the filename, like doing a basedir on a filename.
|
static String |
getDomainUrl(String url)
Gets the domain url.
|
static String |
getExtension(String url)
gets the Extension of an URL (better than commons-io)
|
static String |
getFileExtension(String url)
Returns file extension from url.
|
static String |
getFilename(String url)
gets the FileName (with extension) of an URL (better than commons-io)
|
static String[] |
getFileNameArray(String url)
get the correct name/extension/filename of url (even with parameters! - commons-io CANNOT)
|
static Locale |
getLocaleFromLanguage(String language)
Gets a correct Locale (language + country) from given language.
|
static String |
getPathName(String url)
Gets the path name.
|
static URI |
getURIEncoded(String url)
Casts url string to URI, and does the correct encoding (rfc2396) of query string ONLY (eg "|" character).
|
static String |
joinUrlPath(String baseUrl,
String path)
Join url path.
|
public static URI getURIEncoded(String url) throws URISyntaxException
url
- the url as stringURISyntaxException
- if url could not be parsed / invalidpublic static String getFileExtension(String url) throws URISyntaxException
url
- the urlURISyntaxException
- if url is not validpublic static String getBasename(String url)
url
- the to get the base name frompublic static String getExtension(String url)
url
- the to get the extension frompublic static String getFilename(String url)
url
- the to get the file name frompublic static String getBaseUrl(String url)
url
- the urlpublic static String getDomainUrl(String url)
url
- the urlpublic static String joinUrlPath(String baseUrl, String path)
baseUrl
- the base urlpath
- the pathpublic static String getPathName(String url)
url
- the urlpublic static String[] getFileNameArray(String url)
url
- the urlpublic static String encode(String data)
data
- the datapublic static String generateUA()
public static String generateUA(String language)
language
- take the given language rather than the systems defaultCopyright © 2012–2017 tinyMediaManager. All rights reserved.