public class UrlDecoder extends Object implements Serializable
1. 将%20转换为空格 ; 2. 将"%xy"转换为文本形式,xy是两位16进制的数值; 3. 跳过不符合规范的%形式,直接输出
| Constructor and Description |
|---|
UrlDecoder() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
decode(byte[] bytes)
解码
1.
|
static byte[] |
decode(byte[] bytes,
boolean isPlusToSpace)
解码
1.
|
static String |
decode(String str)
|
static String |
decode(String str,
boolean isPlusToSpace)
解码
1.
|
static String |
decode(String str,
Charset charset)
|
static String |
decode(String str,
Charset charset,
boolean isPlusToSpace)
解码
1.
|
static String |
decodeForPath(String str,
Charset charset)
解码,不对+解码
将%20转换为空格
将 "%xy"转换为文本形式,xy是两位16进制的数值
跳过不符合规范的%形式,直接输出
|
public static String decodeForPath(String str, Charset charset)
str - 包含URL编码后的字符串charset - 解码的编码,null表示不做解码public static String decode(String str)
1. 将+和%20转换为空格(" ");
2. 将"%xy"转换为文本形式,xy是两位16进制的数值;
3. 跳过不符合规范的%形式,直接输出
str - 包含URL编码后的字符串public static String decode(String str, Charset charset)
1. 将+和%20转换为空格(" ");
2. 将"%xy"转换为文本形式,xy是两位16进制的数值;
3. 跳过不符合规范的%形式,直接输出
str - 包含URL编码后的字符串charset - 编码public static String decode(String str, boolean isPlusToSpace)
1. 将%20转换为空格 ; 2. 将"%xy"转换为文本形式,xy是两位16进制的数值; 3. 跳过不符合规范的%形式,直接输出
str - 包含URL编码后的字符串isPlusToSpace - 是否+转换为空格public static String decode(String str, Charset charset, boolean isPlusToSpace)
1. 将%20转换为空格 ; 2. 将"%xy"转换为文本形式,xy是两位16进制的数值; 3. 跳过不符合规范的%形式,直接输出
str - 包含URL编码后的字符串isPlusToSpace - 是否+转换为空格charset - 编码,null表示不做解码public static byte[] decode(byte[] bytes)
1. 将+和%20转换为空格 ; 2. 将"%xy"转换为文本形式,xy是两位16进制的数值; 3. 跳过不符合规范的%形式,直接输出
bytes - url编码的bytespublic static byte[] decode(byte[] bytes,
boolean isPlusToSpace)
1. 将%20转换为空格 ; 2. 将"%xy"转换为文本形式,xy是两位16进制的数值; 3. 跳过不符合规范的%形式,直接输出
bytes - url编码的bytesisPlusToSpace - 是否+转换为空格Copyright © 2025. All rights reserved.