String |
encodedPath()
该URL编码后用于HTTP资源解析。返回的路径将以 /开始
URLencodedPath()
http://host//
http://host/a/b/c"/a/b/c"
http://host/a/b%20c/d"/a/b%20c/d"
List<String> |
encodedPathSegments()
返回一个已编码的路径段列表 ["a", "b", "c"] for the URL http://host/a/b/c.
|
String |
encodedQuery()
Returns the query of this URL, encoded for use in HTTP resource resolution.
|
String |
encodedUsername() |
boolean |
equals(Object other) |
String |
fragment()
返回这个URL的片段 "abc" for http://host/#abc.
|
static UnoUrl |
get(String url) |
static UnoUrl |
get(URI uri) |
static UnoUrl |
get(URL url) |
int |
hashCode() |
String |
host()
A regular host name, like android.com.
|
boolean |
isHttps() |
UnoUrl.Builder |
newBuilder() |
UnoUrl.Builder |
newBuilder(String link) |
static UnoUrl |
parse(String url) |
String |
password()
返回已解码的密码,如果不存在,则返回空字符串.
|
List<String> |
pathSegments()
Returns a list of path segments like ["a", "b", "c"] for the URL http://host/a/b/c.
|
int |
pathSize()
Returns the number of segments in this URL's path.
|
static String |
percentDecode(String encoded,
boolean plusIsSpace) |
int |
port()
URLport()
http://host/80
http://host:8000/8000
https://host/443
String |
query()
Returns this URL's query, like "abc" for http://host/?abc.
|
String |
queryParameter(String name)
Returns the first query parameter named name decoded using UTF-8, or null if there is
no such query parameter.
|
String |
queryParameterName(int index)
Returns the name of the query parameter at index.
|
Set<String> |
queryParameterNames()
Returns the distinct query parameter names in this URL, like ["a", "b"] for http://host/?a=apple&b=banana.
|
String |
queryParameterValue(int index)
Returns the value of the query parameter at index.
|
List<String> |
queryParameterValues(String name)
Returns all values for the query parameter name ordered by their appearance in this
URL.
|
int |
querySize()
Returns the number of query parameters in this URL, like 2 for http://host/?a=apple&b=banana.
|
String |
redact() |
UnoUrl |
resolve(String link) |
String |
scheme() |
String |
topPrivateDomain()
通常,这个方法不应该用来测试一个域是否有效或可路由。相反,DNS是推荐的信息来源
URLtopPrivateDomain()
http://google.com"google.com"
http://adwords.google.co.uk"google.co.uk"
http://co.uknull
http://localhostnull
http://127.0.0.1null
String |
toString() |
URI |
uri() |
URL |
url() |
String |
username()
返回已解码的用户名,如果不存在,则返回空字符串.
|
-
-
Method Detail
-
canonicalize
public static String canonicalize(String input,
String encodeSet,
boolean alreadyEncoded,
boolean strict,
boolean plusIsSpace,
boolean asciiOnly,
Charset charset)
-
isHttps
public boolean isHttps()
-
username
public String username()
返回已解码的用户名,如果不存在,则返回空字符串.
| URL | username() |
http://host/ | "" |
http://username@host/ | "username" |
http://username:password@host/ | "username" |
http://a%20b:c%20d@host/ | "a b" |
- Returns:
- 用户信息
-
password
public String password()
返回已解码的密码,如果不存在,则返回空字符串.
| URL | password() |
http://host/ | "" |
http://username@host/ | "" |
http://username:password@host/ | "password" |
http://a%20b:c%20d@host/ | "c d" |
- Returns:
- 返回已解码的密码
-
host
public String host()
- A regular host name, like
android.com.
- An IPv4 address, like
127.0.0.1.
- An IPv6 address, like
::1.
- An encoded IDN, like
xn--n3h.net.
| URL | host() |
http://android.com/ | "android.com" |
http://127.0.0.1/ | "127.0.0.1" |
http://[::1]/ | "::1" |
http://xn--n3h.net/ | "xn--n3h.net" |
- Returns:
- 主机host
-
port
public int port()
| URL | port() |
http://host/ | 80 |
http://host:8000/ | 8000 |
https://host/ | 443 |
- Returns:
- 端口
-
pathSize
public int pathSize()
Returns the number of segments in this URL's path. This is also the number of slashes in the
URL's path, like 3 in http://host/a/b/c. This is always at least 1.
| URL | pathSize() |
http://host/ | 1 |
http://host/a/b/c | 3 |
http://host/a/b/c/ | 4 |
- Returns:
- the size
-
query
public String query()
Returns this URL's query, like "abc" for http://host/?abc. Most callers should
prefer queryParameterName(int) and queryParameterValue(int) because these methods offer
direct access to individual query parameters.
| URL | query() |
http://host/ | null |
http://host/? | "" |
http://host/?a=apple&k=key+lime | "a=apple&k=key
lime" |
http://host/?a=apple&a=apricot | "a=apple&a=apricot" |
http://host/?a=apple&b | "a=apple&b" |
- Returns:
- the string
-
querySize
public int querySize()
Returns the number of query parameters in this URL, like 2 for http://host/?a=apple&b=banana. If this URL has no query this returns 0. Otherwise it returns
one more than the number of "&" separators in the query.
| URL | querySize() |
http://host/ | 0 |
http://host/? | 1 |
http://host/?a=apple&k=key+lime | 2 |
http://host/?a=apple&a=apricot | 2 |
http://host/?a=apple&b | 2 |
- Returns:
- the int
-
fragment
public String fragment()
返回这个URL的片段 "abc" for http://host/#abc. 如果URL没有片段,则返回null
| URL | fragment() |
http://host/ | null |
http://host/# | "" |
http://host/#abc | "abc" |
http://host/#abc|def | "abc|def" |
- Returns:
- the string
Copyright © 2020. All rights reserved.
| | |