public abstract class UrlUtils extends Object
| 构造器和说明 |
|---|
UrlUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static String |
decode(String s)
字符串进行URL解码,默认采用UTF_8编码
|
static String |
decode(String s,
Charset charset)
字符串进行URL解码.
|
static String |
decodeForBase64(String s)
字符串进行URL解码,用于反编译Base64串,默认采用UTF_8编码.
|
static String |
decodeForBase64(String s,
Charset charset)
字符串进行URL解码(用于反编译Base64串).
|
static String |
encode(String s)
字符串进行URL编码,编码方式:UTF-8
|
static String |
encode(String s,
Charset charset)
字符串进行URL编码。
|
static String |
joinQueryString(String urlOrPath,
Map<String,String> queryStringMap)
拼接QueryString参数
|
static String |
normalizePath(String path)
标准化路径
"\"替换为"/"
为URL时,取路径
连续的'/'和\s,替换为单个'/'
移除最后一位'/'
前面补齐’/‘
|
@NonNull public static String normalizePath(String path)
path - 路径public static String encode(String s, Charset charset)
URLEncoder.encode(String, String) 中复制过来,并进行了优化:
- 1、编码入参也由String直接变成了Charset;
- 2、StringBuffer变为StringBuilders - 字符串charset - 字符集IllegalArgumentException - s或charset为空时,将抛出该异常public static String decode(String s, Charset charset)
URLDecoder.decode(String, String) 中复制过来,并进行了优化:
- 1、编码入参也由String直接变成了Charset;
- 2、StringBuffer变为StringBuildercs - 字符串charset - 字符集IllegalArgumentException - s或charset为空时,将抛出该异常public static String decodeForBase64(String s, Charset charset)
URLDecoder.decode(String, String) 中复制过来,并进行了优化:
- 1、编码入参也由String直接变成了Charset;
- 2、StringBuffer变为StringBuildercs - 字符串charset - 字符集IllegalArgumentException - s或charset为空时,将抛出该异常public static String decodeForBase64(String s)
s - 字符串Copyright © 2021–2024 EasyJ寮�婧愮ぞ鍖�. All rights reserved.