Package org.aoju.bus.core.codec
Class PunyCode
java.lang.Object
org.aoju.bus.core.codec.PunyCode
Punycode是一个根据RFC 3492标准而制定的编码系统,主要用于把域名 从地方语言所采用的Unicode编码转换成为可用于DNS系统的编码
参考:https://blog.csdn.net/a19881029/article/details/18262671
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String解码 PunyCode为字符串static StringdecodeDomain(String domain) 解码 PunyCode为域名static Stringencode(CharSequence input) 将内容编码为PunyCodestatic Stringencode(CharSequence input, boolean withPrefix) 将内容编码为PunyCodestatic StringencodeDomain(String domain) 将域名编码为PunyCode,会忽略"."
-
Field Details
-
PUNY_CODE_PREFIX
- See Also:
-
-
Constructor Details
-
PunyCode
public PunyCode()
-
-
Method Details
-
encode
将内容编码为PunyCode- Parameters:
input- 字符串- Returns:
- PunyCode字符串
- Throws:
InternalException- 计算异常
-
encode
将内容编码为PunyCode- Parameters:
input- 字符串withPrefix- 是否包含 "xn--"前缀- Returns:
- PunyCode字符串
- Throws:
InternalException- 计算异常
-
decode
解码 PunyCode为字符串- Parameters:
input- PunyCode- Returns:
- 字符串
- Throws:
InternalException- 计算异常
-
encodeDomain
将域名编码为PunyCode,会忽略"."的编码- Parameters:
domain- 域名- Returns:
- 编码后的域名
- Throws:
InternalException- 计算异常
-
decodeDomain
解码 PunyCode为域名- Parameters:
domain- 域名- Returns:
- 解码后的域名
- Throws:
InternalException- 计算异常
-