Package org.miaixz.bus.core.net.url
Class UrlEncoder
java.lang.Object
org.miaixz.bus.core.net.url.UrlEncoder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String编码URL,默认使用UTF-8编码 将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。。static String编码URL 将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。static StringencodeBlank(CharSequence urlStr) 单独编码URL中的空白符,空白符编码为%20static StringencodeQuery(String url) 编码URL,默认使用UTF-8编码 将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。static StringencodeQuery(String url, Charset charset) 编码字符为URL中查询语句 将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。
-
Constructor Details
-
UrlEncoder
public UrlEncoder()
-
-
Method Details
-
encodeAll
编码URL,默认使用UTF-8编码 将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。。不参与编码的字符:unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- Parameters:
url- URL- Returns:
- 编码后的URL
- Throws:
InternalException- UnsupportedEncodingException
-
encodeAll
编码URL 将需要转换的内容(ASCII码形式之外的内容),用十六进制表示法转换出来,并在之前加上%开头。不参与编码的字符:unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- Parameters:
url- URLcharset- 编码,为null表示不编码- Returns:
- 编码后的URL
- Throws:
InternalException- UnsupportedEncodingException
-
encodeQuery
-
encodeQuery
-
encodeBlank
单独编码URL中的空白符,空白符编码为%20- Parameters:
urlStr- URL字符串- Returns:
- 编码后的字符串
-